This repository was archived by the owner on Aug 23, 2026. It is now read-only.
forked from ipitio/backage
-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (105 loc) · 3.61 KB
/
Copy pathmanual.yml
File metadata and controls
123 lines (105 loc) · 3.61 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: manual
on:
workflow_dispatch:
workflow_run:
workflows: ["build"]
types: [completed]
branches:
- master
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 }}
BKG_HANDOFF_CONTROL_REF: refs/heads/bkg-control
BKG_HANDOFF_POLL_SECONDS: 60
jobs:
handoff:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') }}
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version-file: ".python-version"
- name: Request graceful handoff
run: PYTHONPATH=src python -m bkg_py handoff request
update:
needs: handoff
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') }}
concurrency:
group: ${{ github.repository }}-database-publication
cancel-in-progress: false
queue: max
permissions:
contents: write
packages: read
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Check for release
id: release
continue-on-error: true
uses: cardinalby/git-get-release-action@v1
with:
latest: true
- name: Fetch all data
if: ${{ steps.release.outcome == 'success' }}
continue-on-error: true
uses: robinraju/release-downloader@v1
with:
latest: true
fileName: "*.db"
tarBall: false
zipBall: false
out-file-path: ".bkg/.snapshot"
- name: Update
id: update
run: |
set +e
run_date=$(date -u +%F)
docker run --rm \
--volume "$PWD:/app" \
--volume /var/run/docker.sock:/var/run/docker.sock \
--env BKG_DOCKER_SIZE_FALLBACK=true \
--env BKG_HANDOFF_CONTROL_REF \
--env BKG_HANDOFF_GIT_TIMEOUT_SECONDS \
--env BKG_HANDOFF_POLL_SECONDS \
--env GITHUB_ACTOR \
--env GITHUB_BRANCH \
--env GITHUB_OWNER \
--env GITHUB_REPO \
--env GITHUB_RUN_ID \
--env GITHUB_TOKEN \
"ghcr.io/$GITHUB_OWNER/$GITHUB_REPO:master" \
bkg workflow-update -C /app -D "$run_date"
code=$?
echo "updated=$code" >> "$GITHUB_OUTPUT"
echo "run_date=$run_date" >> "$GITHUB_OUTPUT"
exit "$code"
- name: Get date
id: date
env:
RUN_DATE: ${{ steps.update.outputs.run_date }}
run: |
release_tag=$(docker run --rm ghcr.io/$GITHUB_OWNER/$GITHUB_REPO:master bkg release-tag -D "$RUN_DATE")
echo "tag=$release_tag" >> "$GITHUB_OUTPUT"
- name: Save database
if: ${{ steps.update.outputs.updated == '0' }}
uses: ncipollo/release-action@v1
with:
artifacts: "bkg/.snapshot/*"
bodyFile: "bkg/CHANGELOG.md"
tag: "${{ steps.date.outputs.tag }}"
commit: "master"
allowUpdates: true