diff --git a/.gitea/workflows/bump-pkgrel.sh b/.gitea/workflows/bump-pkgrel.sh new file mode 100755 index 0000000..99d0e9d --- /dev/null +++ b/.gitea/workflows/bump-pkgrel.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Run your check script +.gitea/workflows/check-up-to-date.sh +RETVAL=$? + +if [ $RETVAL -eq 1 ]; then + echo "Changes detected, bumping pkgrel..." + + # Use sed to increment pkgrel in the PKGBUILD file + sed -i -E 's/^(pkgrel=)([0-9]+)/echo "\1$((\2 + 1))"/e' PKGBUILD + + # Get the new pkgrel value for the commit message + NEW_PKGREL=$(grep ^pkgrel= PKGBUILD | cut -d= -f2) + + # Add, commit, and push the change + git add PKGBUILD + git commit -m "Bump pkgrel to ${NEW_PKGREL}" + git push + + echo "pkgrel bumped to ${NEW_PKGREL} and changes pushed." +else + echo "No changes detected. Nothing to do." +fi diff --git a/.gitea/workflows/up-to-date.sh b/.gitea/workflows/check-up-to-date.sh similarity index 100% rename from .gitea/workflows/up-to-date.sh rename to .gitea/workflows/check-up-to-date.sh diff --git a/.gitea/workflows/workflow.yml b/.gitea/workflows/workflow.yml index 9d1350b..c2d1913 100644 --- a/.gitea/workflows/workflow.yml +++ b/.gitea/workflows/workflow.yml @@ -3,6 +3,8 @@ on: push: branches: - master + schedule: + - cron: '*/2 * * * *' jobs: update: @@ -46,8 +48,7 @@ jobs: name: Check if rebuild is necessary runs-on: ubuntu-amd64 needs: update - outputs: - up-to-date: ${{ steps.up-to-date.outputs.exit_code }} + if: ${{ github.event_name == 'schedule' }} container: image: gitea.seeseepuff.be/archlinux/archlinux:latest steps: @@ -61,10 +62,9 @@ jobs: - name: Check if rebuild is necessary id: up-to-date run: | - set +e - .gitea/workflows/up-to-date.sh - echo "exit_code=$?" >> "$GITHUB_OUTPUT" - set -e + git config user.email "sebastiaan.de.schaetzen+archlinux@gmail.com" + git config user.name "Sebastiaan de Schaetzen (automated)" + .gitea/workflows/bump-pkgrel.sh build: name: Build and Push @@ -72,7 +72,7 @@ jobs: needs: check container: image: gitea.seeseepuff.be/archlinux/archlinux:latest - if: needs.check.outputs.up-to-date == '1' + if: ${{ github.event_name == 'push' }} steps: - name: Checkout code uses: actions/checkout@v2