Skip to content

Release

Release #25

Workflow file for this run

name: Release
on:
pull_request:
branches:
- main
workflow_dispatch:
inputs:
version_rule:
description: "Version to bump (major, minor, patch)"
required: true
type: choice
options:
- "major"
- "minor"
- "patch"
default: "minor"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install Poetry
run: |
pip install poetry
- name: Update the version
id: bump_version
run: |
poetry version ${{ github.event.inputs.version_rule }}
echo VERSION=$(poetry version -s) >> "$GITHUB_OUTPUT"
# First create a PR for the new version before pushing the artifacts. If this fails, we can just rerun the job since there are no artifacts uploaded yet.
- name: commit the new pyproject.toml with the new version
uses: EndBug/add-and-commit@v9 # You can change this to use a specific version.
with:
message: "chore(ci): bumped the version to ${{ steps.bump_version.outputs.VERSION }}"
new_branch: "chore/version-bump-${{ steps.bump_version.outputs.VERSION }}"
default_author: github_actions
- name: create pull request
run: gh pr create -B main -H "chore/version-bump-${{ steps.bump_version.outputs.VERSION }}" --title 'Bump the version to ${{ steps.bump_version.outputs.VERSION }}' --body 'Created by the `Release` Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: merge pull request
run: gh pr merge "chore/version-bump-${{ steps.bump_version.outputs.VERSION }}" --delete-branch --squash --admin --subject "Bump the version to ${{ steps.bump_version.outputs.VERSION }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Build and publish
# run: |
# poetry install --no-dev
# poetry build
# # poetry publish