update #10551
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: update | |
on: | |
schedule: | |
- cron: "* */3 * * *" | |
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: | |
# sqlite3-pcre is last available on Ubuntu 23.04 as of 2024-10-11 | |
runs-on: ubuntu-22.04 | |
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/ipitio/backage:master \ | |
bash src/test/update.sh -m 0; 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 |