Check and Update Lonesnake Version #689
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: Check and Update Lonesnake Version | |
| on: | |
| schedule: | |
| - cron: "0 4 * * *" # Runs daily at 04:00 UTC | |
| workflow_dispatch: # Allows manual triggering | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| ref: main | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.x" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install beautifulsoup4 requests | |
| - name: Get current prog version and next prog version | |
| id: version_definitions | |
| run: | | |
| current_prog_version="$(./release.py current-prog-version)" | |
| echo "Current version of lonesnake: ${current_prog_version}" | |
| echo "current_prog_version=${current_prog_version}" >> $GITHUB_OUTPUT | |
| next_prog_version="$(./release.py next-prog-version)" | |
| echo "Next version will be: $next_prog_version" | |
| echo "next_prog_version=$next_prog_version" >> $GITHUB_OUTPUT | |
| - name: Check for updates | |
| id: check_updates | |
| run: | | |
| has_new_updates=1 | |
| current_branch_updates_output="$(./release.py is-new-update-available)" | |
| if [[ "$current_branch_updates_output" =~ "NO UPDATE AVAILABLE" ]]; then | |
| echo "CPython releases in lonesnake are up-to-date" | |
| has_new_updates=0 | |
| else | |
| echo "$current_branch_updates_output" | |
| fi | |
| echo "has_new_updates=${has_new_updates}" >> $GITHUB_OUTPUT | |
| - name: Update patch block and prog version | |
| if: steps.check_updates.outputs.has_new_updates == 1 | |
| run: | | |
| ./release.py overwrite-latest-patch-block | |
| ./release.py overwrite-prog-version ${{ steps.version_definitions.outputs.next_prog_version }} | |
| - name: Commit and push changes | |
| if: steps.check_updates.outputs.has_new_updates == 1 | |
| run: | | |
| git config user.name "GitHub Actions Bot" | |
| git config user.email "actions@github.com" | |
| git add README.md lonesnake helpers/lonesnake-kit | |
| git commit -m "Update lonesnake from ${{ steps.version_definitions.outputs.current_prog_version }} to ${{ steps.version_definitions.outputs.next_prog_version }} with new CPython patch versions" | |
| git push origin main | |
| - name: Create GitHub Release | |
| if: steps.check_updates.outputs.has_new_updates == 1 | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release create "${{ steps.version_definitions.outputs.next_prog_version }}" \ | |
| --title "${{ steps.version_definitions.outputs.next_prog_version }}" \ | |
| --generate-notes |