release #4
This file contains 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: release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Semantic version tag (e.g., 1.2.3)" | |
required: true | |
env: | |
PYTHON_VERSION: "3.12" | |
jobs: | |
workflow: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout codebase | |
uses: actions/checkout@v4 | |
- name: Setup python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Setup poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
- name: Checkout new release branch | |
run: | | |
git checkout -b gh/release-${{ inputs.version }} | |
- name: Update version in `pyproject.toml` | |
run: | | |
poetry version ${{ inputs.version }} | |
- name: Commit version bump | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
git add pyproject.toml | |
git commit -m "build: bump version to ${{ inputs.version }}" | |
git push origin master | |
- name: Push changes to release branch | |
run: | | |
git push origin gh/release-${{ inputs.version }} | |
- name: Create release | |
run: | | |
gh release create ${{ inputs.version }} --title ${{ inputs.version }} --notes "Release ${{ inputs.version }}" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish to PyPI | |
run: | | |
poetry publish --build --username __token__ --password ${{ secrets.PYPI_TOKEN }} | |
- name: Create pull request | |
run: | | |
gh pr create --title "build: release `${{ inputs.version }}`" --body "Release ${{ inputs.version }}" --base master --head gh/release-${{ inputs.version }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |