Skip to content

Release workflow

Release workflow #17

Workflow file for this run

name: Release
on:
# workflow_dispatch:
# inputs:
# release_type:
# description: 'Type of release'
# required: true
# default: 'patch'
# type: choice
# options:
# - major
# - minor
# - patch
pull_request:
branches: [ main ]
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: PyO3/maturin-action@v1
with:
command: build
sccache: true
args: --release
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true
- name: Bump version
id: bump
run: |
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "$(gh api /users/${GITHUB_ACTOR} | jq .name -r)"
git config -l
echo "previous-version=$(uvx bump-my-version show current_version)" | tee -a $GITHUB_OUTPUT
uvx bump-my-version bump patch
([[ $? -gt 0 ]] && echo "bumped=false" || echo "bumped=true") | tee -a $GITHUB_OUTPUT
echo "current-version=$(uvx bump-my-version show current_version)" | tee -a $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ github.token }}
- name: Push bumped version
run: |
target_ref=${{ github.head_ref && format('refs/heads/{0}', github.head_ref) || github.ref }}
git push origin HEAD:$target_ref
git push origin v${{ steps.bump.outputs.current-version }}:refs/tags/test-v${{ steps.bump.outputs.current-version }}
# - name: Create GitHub Release
# if: steps.bump.outputs.bumped == 'true'
# uses: softprops/action-gh-release@v2
# with:
# tag_name: v${{ steps.bump.outputs.current-version }}
# name: Release v${{ steps.bump.outputs.current-version }}
# files: |
# target/wheels/*.whl
# draft: false
# prerelease: false
# generate_release_notes: true
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}