forked from ipitio/backage
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (69 loc) · 2.16 KB
/
update.yml
File metadata and controls
84 lines (69 loc) · 2.16 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
name: update
on:
schedule:
- cron: "0 * * * *"
concurrency:
group: ${{ github.ref }}
cancel-in-progress: false
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:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Tune dpkg
uses: abbbi/github-actions-tune@v1
- name: Set dpkg
run: sudo rm -f /usr/local/bin/dpkg
- name: Tune apt
uses: firebuild/apt-eatmydata-action@v1
- 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: "*.zst"
tarBall: false
zipBall: false
out-file-path: ".bkg"
- name: Dry run
id: update
run: |
set +e
docker run -v $PWD:/app --env-file <(env | grep GITHUB) \
ghcr.io/ipitio/backage:master \
src/test/update.sh bkg
code=$?
echo "updated=$code" >> "$GITHUB_OUTPUT"
exit "$code"
- name: Get date
id: date
run: echo "tag=$(date -u +%-Y.%-m).$((($(date -u +%-d)-1)/14))" >> "$GITHUB_OUTPUT"
- name: Save database
if: ${{ steps.update.outputs.updated == '0' }}
uses: ncipollo/release-action@v1
with:
artifacts: "bkg/*.zst"
bodyFile: "bkg/CHANGELOG.md"
tag: "v${{ steps.date.outputs.tag }}"
commit: "master"
allowUpdates: true