Update App Versions #72
This file contains hidden or 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 App Versions | |
| on: | |
| schedule: | |
| - cron: '0 0 * * 0' # Runs weekly on Sunday at midnight UTC | |
| workflow_dispatch: # Allows manual trigger | |
| jobs: | |
| update_versions: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| actions: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run update versions script | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| chmod +x .github/scripts/update_versions.sh | |
| bash .github/scripts/update_versions.sh | |
| - name: Check for changes | |
| id: check_changes | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| echo "changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and push if changed | |
| if: steps.check_changes.outputs.changes == 'true' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "GitHub Action" | |
| git add -A | |
| git commit -m "Update app versions with latest releases from GitHub" | |
| # Push changes | |
| git push origin HEAD:${GITHUB_REF#refs/heads/} | |
| - name: Trigger update-metadata workflow | |
| if: steps.check_changes.outputs.changes == 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| curl -X POST -H "Accept: application/vnd.github.v3+json" \ | |
| -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
| https://api.github.com/repos/${{ github.repository }}/actions/workflows/update-metadata.yml/dispatches \ | |
| -d '{"ref": "${{ github.ref }}"}' |