-
Notifications
You must be signed in to change notification settings - Fork 10
87 lines (72 loc) · 2.32 KB
/
manual.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: manual
on:
workflow_dispatch:
workflow_run:
workflows: ["build"]
types: [completed]
pull_request:
types:
- closed
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
defaults:
run:
# GitHub Actions run without a TTY device. This is a workaround to get one,
# based on https://github.com/actions/runner/issues/241#issuecomment-2019042651
shell: 'script --return --quiet --log-out /dev/null --command "bash -e {0}"'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_OWNER: ${{ github.repository_owner }}
GITHUB_REPO: ${{ github.event.repository.name }}
GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }}
jobs:
update:
# sqlite3-pcre is last available on Ubuntu 23.04 as of 2024-10-11
runs-on: ubuntu-22.04
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Fetch latest data
run: |
pushd src || exit 1
source lib/util.sh
get_db
popd || exit 1
- name: Fetch all data
uses: robinraju/release-downloader@v1
with:
latest: true
fileName: "*.zst"
tarBall: false
zipBall: false
- name: Dry run
id: update
run: |
docker run -v $PWD:/app --env-file <(env | grep GITHUB) \
ghcr.io/$GITHUB_OWNER/$GITHUB_REPO:master \
bash src/test/update.sh; echo "updated=$?" >> "$GITHUB_OUTPUT"
- name: Get date
id: date
run: |
echo "date=$(date -u +%Y-%m-%d)" >> "$GITHUB_OUTPUT"
echo "tag=$(date -u +%-Y.%-m).$((($(date -u +%-d)-1)/7))" >> "$GITHUB_OUTPUT"
- name: Save state
id: commit
if: ${{ steps.update.outputs.updated == '0' }}
uses: EndBug/add-and-commit@v9
with:
add: "-- *.txt README.md"
message: "${{ steps.date.outputs.date }}"
- name: Save database
if: ${{ steps.update.outputs.updated == '0' }}
uses: ncipollo/release-action@v1
with:
artifacts: "*.zst"
bodyFile: "CHANGELOG.md"
tag: "v${{ steps.date.outputs.tag }}"
commit: "master"
allowUpdates: true