Update GitHub Actions for Node 24 runtime (#314) #41
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: Versioning | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - changelog.d/** | |
| - .github/** | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| version-bump: | |
| name: Build changelog and bump version | |
| runs-on: ubuntu-latest | |
| if: github.event.head_commit.message != 'Update package version' | |
| steps: | |
| - name: Generate GitHub App token | |
| id: app-token | |
| uses: actions/create-github-app-token@v3 | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| with: | |
| save-cache: false | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| - name: Install dependencies | |
| run: uv pip install --system towncrier | |
| - name: Bump version and build changelog | |
| run: | | |
| python .github/bump_version.py | |
| VERSION=$(python -c "import re; print(re.search(r'version = \"(.+?)\"', open('pyproject.toml').read()).group(1))") | |
| towncrier build --yes --version "$VERSION" | |
| - name: Commit version bump | |
| uses: EndBug/add-and-commit@v10 | |
| with: | |
| add: "." | |
| message: Update package version | |
| release: | |
| name: Create release | |
| runs-on: ubuntu-latest | |
| if: github.event.head_commit.message == 'Update package version' | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - name: Get version | |
| id: get-version | |
| run: | | |
| VERSION=$(python -c "import re; print(re.search(r'version = \"(.+?)\"', open('pyproject.toml').read()).group(1))") | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "Version: $VERSION" | |
| - name: Create git tag | |
| run: | | |
| git tag "v${{ steps.get-version.outputs.version }}" | |
| git push origin "v${{ steps.get-version.outputs.version }}" | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release create "v${{ steps.get-version.outputs.version }}" \ | |
| --title "v${{ steps.get-version.outputs.version }}" \ | |
| --notes "See [CHANGELOG.md](https://github.com/PolicyEngine/policyengine-api-v2-alpha/blob/main/CHANGELOG.md) for details." \ | |
| --latest |