-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (57 loc) · 1.91 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: build
on:
pull_request:
branches:
- main
schedule:
- cron: "0 * * * *"
defaults:
run:
# NOTE: Default option does not include `-o pipefail` as documented
# unless explicitly specifying the `bash` shell.
# https://github.com/actions/runner/issues/353
shell: bash
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: Checkout branch
uses: actions/[email protected]
- name: Set up Go
uses: actions/[email protected]
- name: Install blt
run: |
go install \
github.com/loozhengyuan/blt/cmd/blt@latest
- name: Build blocklist
run: |
blt build .blt.yaml
- name: Generate checksums
run: |
sha256sum dist/*.txt > dist/SHA256SUMS
# NOTE: The commit email address should be the canonical no-reply email address
# used by the `github-actions[bot]` bot user.
# https://api.github.com/users/github-actions%5Bbot%5D
# https://github.community/t/github-actions-bot-email-address/17204/6
- name: Set up git config
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Stage changes
run: |
git add dist/
- name: Diff staged changes
run: |
git diff --staged
# NOTE: The `git commit` command returns a non-zero exit code if there are no changes
# to commit. Using the `git diff-index` command checks if there are changes in the
# index (i.e. the staging area).
- name: Commit changes
run: |
git diff-index --quiet --cached HEAD || git commit -m "chore: rebuild blocklist"
- name: Push commit
# NOTE: We only want changes to updated on the scheduled runs
if: ${{ github.event_name == 'schedule' }}
run: |
git push