Skip to content

Update

Update #4

Workflow file for this run

name: Update
on:
schedule:
- cron: "0 4 * * *"
workflow_dispatch:
permissions:
contents: write
jobs:
check-and-update:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Get latest release version
id: latest_release
run: |
set -euo pipefail
LATEST_TAG=$(curl -sL https://api.github.com/repos/chiriapp/chiri/releases/latest | jq -r ".tag_name")
VERSION=${LATEST_TAG#app-v}
VERSION=${VERSION#v}
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Get current version
id: current_version
run: |
set -euo pipefail
CURRENT=$(grep -E "^pkgver=" PKGBUILD | cut -d= -f2 | tr -d '"')
echo "version=${CURRENT}" >> "$GITHUB_OUTPUT"
- name: Run update script
if: steps.latest_release.outputs.version != steps.current_version.outputs.version
env:
VERSION: ${{ steps.latest_release.outputs.version }}
run: |
set -euo pipefail
python3 update.py "$VERSION"
- name: Commit and push to GitHub repository
if: steps.latest_release.outputs.version != steps.current_version.outputs.version
env:
VERSION: ${{ steps.latest_release.outputs.version }}
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add PKGBUILD .SRCINFO
if git diff --staged --quiet; then
echo "Nothing to commit."
exit 0
fi
git commit -m "chore: update to v${VERSION}"
git push
- name: Push to AUR
if: steps.latest_release.outputs.version != steps.current_version.outputs.version
uses: ./.github/actions/push-aur
with:
aur_repo: ssh://aur@aur.archlinux.org/chiri.git
files: PKGBUILD .SRCINFO chiri.desktop chiri.install
commit_message: "chore: update to v${{ steps.latest_release.outputs.version }}"
aur_ssh_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}