Skip to content

Commit aa4b857

Browse files
authored
Add files via upload
1 parent 7a05ffd commit aa4b857

3 files changed

Lines changed: 117 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-go@v5
15+
with:
16+
go-version-file: go.mod
17+
cache: true
18+
- run: go test ./...

.github/workflows/pages.yml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
name: Deploy GitHub Pages
1+
name: Publish site
22

33
on:
44
push:
5-
branches: ["main"]
5+
branches:
6+
- main
7+
paths:
8+
- site/**
9+
- .github/workflows/pages.yml
610
workflow_dispatch:
711

812
permissions:
@@ -12,28 +16,27 @@ permissions:
1216

1317
concurrency:
1418
group: pages
15-
cancel-in-progress: false
19+
cancel-in-progress: true
1620

1721
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: actions/configure-pages@v5
27+
- run: |
28+
mkdir -p public
29+
cp -R site/. public/
30+
- uses: actions/upload-pages-artifact@v3
31+
with:
32+
path: public
33+
1834
deploy:
35+
needs: build
36+
runs-on: ubuntu-latest
1937
environment:
2038
name: github-pages
2139
url: ${{ steps.deployment.outputs.page_url }}
22-
23-
runs-on: ubuntu-latest
24-
2540
steps:
26-
- name: Checkout
27-
uses: actions/checkout@v4
28-
29-
- name: Configure Pages
30-
uses: actions/configure-pages@v5
31-
32-
- name: Upload site artifact
33-
uses: actions/upload-pages-artifact@v3
34-
with:
35-
path: ./site
36-
37-
- name: Deploy to GitHub Pages
38-
id: deployment
41+
- id: deployment
3942
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Release database
2+
3+
on:
4+
schedule:
5+
- cron: "17 3 * * *"
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
database:
13+
name: Build and publish database
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version-file: go.mod
21+
cache: true
22+
23+
- name: Resolve release tag
24+
id: release
25+
run: |
26+
day="$(date -u +'%Y.%m.%d')"
27+
echo "tag=$day" >> "$GITHUB_OUTPUT"
28+
echo "name=Blackroute $day" >> "$GITHUB_OUTPUT"
29+
30+
- name: Build Blackroute database
31+
env:
32+
VERSION: ${{ steps.release.outputs.tag }}
33+
run: |
34+
set -euo pipefail
35+
mkdir -p dist
36+
37+
go build -trimpath -ldflags="-s -w" -o ./bin/blackroute ./cmd/collector
38+
./bin/blackroute --feeds=configs/feeds.yaml --output=release --skip-mmdb
39+
go run ./cmd/release-cleaner --feeds=configs/feeds.yaml --release=release
40+
41+
test -s release/blackroute.mmdb
42+
test -s release/blackroute.csv
43+
test -s release/blackroute.jsonl
44+
test -s release/run_stats.json
45+
test -s release/cleanup_stats.json
46+
test -s release/release_summary.md
47+
48+
cp release/blackroute.mmdb "dist/blackroute_${VERSION}.mmdb"
49+
cp release/run_stats.json "dist/blackroute_${VERSION}_run_stats.json"
50+
cp release/cleanup_stats.json "dist/blackroute_${VERSION}_cleanup_stats.json"
51+
cp release/release_summary.md "dist/blackroute_${VERSION}_release_summary.md"
52+
tar -czf "dist/blackroute_${VERSION}_exports.tar.gz" -C release \
53+
blackroute.csv blackroute.jsonl run_stats.json cleanup_stats.json release_summary.md
54+
55+
- name: Checksums
56+
run: |
57+
cd dist
58+
find . -maxdepth 1 -type f ! -name checksums.txt -print0 \
59+
| sort -z \
60+
| xargs -0 sha256sum > checksums.txt
61+
62+
- name: Publish
63+
uses: softprops/action-gh-release@v2
64+
with:
65+
tag_name: ${{ steps.release.outputs.tag }}
66+
name: ${{ steps.release.outputs.name }}
67+
prerelease: false
68+
make_latest: true
69+
overwrite_files: true
70+
body_path: dist/blackroute_${{ steps.release.outputs.tag }}_release_summary.md
71+
files: |
72+
dist/blackroute_*.mmdb
73+
dist/blackroute_*_exports.tar.gz
74+
dist/blackroute_*_run_stats.json
75+
dist/blackroute_*_cleanup_stats.json
76+
dist/blackroute_*_release_summary.md
77+
dist/checksums.txt

0 commit comments

Comments
 (0)