Files
scoop/.gitea/workflows/autoupdate.yml

50 lines
1.5 KiB
YAML

name: Update Scoop manifests
on:
workflow_dispatch:
schedule:
- cron: '0 * * * *'
jobs:
update:
runs-on: ubuntu-latest
permissions:
code: write
timeout-minutes: 55
steps:
- name: Checkout repository
uses: https://github.com/actions/checkout@v4
with:
ref: ${{ gitea.event.repository.default_branch }}
token: ${{ secrets.GITEA_TOKEN }}
fetch-depth: 0
- name: Check Python runtime
run: python3 -c "import sys; assert sys.version_info >= (3, 10), 'Python 3.10+ erforderlich'"
- name: Test manifest updater
run: python3 -B -m unittest discover -s tests -v
- name: Update manifests
id: update
run: python3 -B scripts/update-manifests.py --write
# Gültige Updates auch dann speichern, wenn ein anderer Download scheitert.
# Der fehlgeschlagene Update-Schritt bleibt im Workflow sichtbar.
- name: Commit and push changed manifests
if: ${{ always() && steps.update.outcome != 'skipped' }}
env:
DEFAULT_BRANCH: ${{ gitea.event.repository.default_branch }}
run: |
set -eu
git add -- bucket/*.json
if git diff --cached --quiet; then
echo 'Keine Manifest-Änderungen.'
exit 0
fi
git config user.name 'Gitea Actions'
git config user.email 'actions@gitea.medelexis.ch'
git commit -m 'Update Scoop manifests'
git pull --rebase origin "$DEFAULT_BRANCH"
git push origin "HEAD:$DEFAULT_BRANCH"