Auto-Update Versions #54
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: Auto-Update Versions | |
| on: | |
| schedule: | |
| - cron: '0 2 * * *' # Run every day at 2am UTC | |
| workflow_dispatch: | |
| jobs: | |
| update-versions: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate App Token | |
| uses: actions/create-github-app-token@v1 | |
| id: app-token | |
| with: | |
| app-id: ${{ vars.APP_ID }} | |
| private-key: ${{ secrets.PRIVATE_KEY }} | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| pip install packaging | |
| - name: Snapshot python-versions.json | |
| run: cp relenv/python-versions.json "${RUNNER_TEMP}/python-versions.before.json" | |
| - name: Run Update Commands | |
| id: update | |
| run: | | |
| python3 -m relenv versions --update-deps | |
| python3 -m relenv versions --update | |
| if git diff --quiet relenv/python-versions.json; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Prepare Release PR | |
| if: steps.update.outputs.changed == 'true' | |
| id: prepare | |
| run: | | |
| python3 .github/scripts/prepare_release_pr.py \ | |
| "${RUNNER_TEMP}/python-versions.before.json" \ | |
| relenv/python-versions.json | tee "${RUNNER_TEMP}/prepare.out" | |
| version="$(head -n1 "${RUNNER_TEMP}/prepare.out")" | |
| echo "version=${version}" >> "$GITHUB_OUTPUT" | |
| - name: Create Pull Request | |
| if: steps.update.outputs.changed == 'true' | |
| id: cpr | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| commit-message: "Release ${{ steps.prepare.outputs.version }}" | |
| title: "Release ${{ steps.prepare.outputs.version }}" | |
| body: | | |
| Automated version bump for Python and bundled dependencies. | |
| This PR will be merged automatically once CI passes, which will | |
| trigger the release workflow. | |
| branch: "auto-update-versions" | |
| base: "main" | |
| delete-branch: true | |
| labels: "automated-update" | |
| add-paths: | | |
| relenv/python-versions.json | |
| relenv/common.py | |
| CHANGELOG.md |