Skip to content

manual

manual #497

Workflow file for this run

name: manual
on:
workflow_dispatch:
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}"'
jobs:
update:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Fetch latest data
run: |
if git ls-remote --exit-code origin index &>/dev/null; then
if [ -d index ]; then
[ ! -d index.bak ] || rm -rf index.bak
mv index index.bak
fi
git fetch origin index
git worktree add index index
pushd index || exit 1
git reset --hard origin/index
popd || exit 1
fi
pushd src || exit 1
[ ! -f ../index/.env ] || \cp ../index/.env env.env
source bkg.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: bash src/test/update.sh -m 2; echo "updated=$?" >> "$GITHUB_OUTPUT"
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 }}
- 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