Skip to content

Merge pull request #113 from PolicyEngine/fix/fix-deploy-errors #3

Merge pull request #113 from PolicyEngine/fix/fix-deploy-errors

Merge pull request #113 from PolicyEngine/fix/fix-deploy-errors #3

Workflow file for this run

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: Checkout repo
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Setup Python
uses: actions/setup-python@v5
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@v9
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@v4
- 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