Skip to content

Generalize release workflow to accommodate major or patch releases #13

Generalize release workflow to accommodate major or patch releases

Generalize release workflow to accommodate major or patch releases #13

Workflow file for this run

name: release
on:
pull_request_target:
types: [closed]
permissions:
contents: write
jobs:
release:
if: >
github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'release')
runs-on: ubuntu-latest
steps:
# 1. Checkout the merged code
- name: Checkout merged code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
fetch-depth: 0
# 2. Setup environment
- name: Install Pixi
uses: prefix-dev/setup-pixi@v0.8.9
- name: Fetch bot identity
id: bot
uses: raven-actions/bot-details@v1
- name: Configure git for committing
run: |
git config user.name "${{ steps.bot.outputs.name }}"
git config user.email "${{ steps.bot.outputs.email }}"
# 3. Bump version + read version
- name: Bump version (patch)
if: contains(github.event.pull_request.labels.*.name, 'release:patch')
run: pixi run bumpver update --patch
- name: Bump version (major)
if: contains(github.event.pull_request.labels.*.name, 'release:major')
run: pixi run bumpver update --major
- name: Get version
id: version
run: |
echo "tag=$(pixi run current-version)" >> "$GITHUB_OUTPUT"
# 4. Create release
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}