Merge pull request #176 from PolicyEngine/maria/final_touches #90
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
| # Workflow that runs on versioning metadata updates. | |
| name: Versioning updates | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "changelog.d/**" | |
| - "CHANGELOG.md" | |
| - "!pyproject.toml" | |
| jobs: | |
| Versioning: | |
| 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@v1 | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.14 | |
| - name: Bump version and build changelog | |
| run: | | |
| pip install towncrier | |
| python .github/bump_version.py | |
| towncrier build --yes --version $(python -c "import re; print(re.search(r'version = \"(.+?)\"', open('pyproject.toml').read()).group(1))") | |
| - name: Update changelog | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| add: "." | |
| message: Update package version | |
| publish-to-pypi: | |
| name: Publish to PyPI | |
| if: (github.event.head_commit.message == 'Update package version') | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.14"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history for all tags and branches | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install package | |
| run: make install | |
| - name: Build package | |
| run: python -m build | |
| - name: Publish a git tag | |
| run: ".github/publish-git-tag.sh || true" | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI }} | |
| skip-existing: true |