Update package version #64
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_entry.yaml | |
| - "!pyproject.toml" | |
| jobs: | |
| Versioning: | |
| runs-on: ubuntu-latest | |
| if: | | |
| (!(github.event.head_commit.message == 'Update package version')) | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| token: ${{ secrets.POLICYENGINE_GITHUB }} | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.13 | |
| - name: Build changelog | |
| run: pip install yaml-changelog && make changelog | |
| - name: Preview changelog update | |
| run: ".github/get-changelog-diff.sh" | |
| - 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 | |
| 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: 3.13 | |
| - 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 | |