Skip to content

Commit

Permalink
chore: add workflow to automatically create release when release cand…
Browse files Browse the repository at this point in the history
…idate is merged
  • Loading branch information
tomjholland committed Feb 28, 2025
1 parent 288778e commit 6320b23
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/create-release-candidate.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: "Create Release Candidate"

on:
push:
pull_request:
types: [closed]
branches:
- main

jobs:
create-rc:
if: ${{ !contains(github.event.head_commit.message, 'release-candidates/') }}
if: github.event.pull_request.merged == true && !startsWith(github.head_ref, 'release-candidates/')
runs-on: ubuntu-latest

permissions:
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Create Release"

on:
pull_request:
types: [closed]
branches:
- main

jobs:
create-release:
# Only run when merge commit is from a release candidate branch
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release-candidates/')
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history

- name: Extract version
id: extract-version
run: |
# Extract version from _version.py file
VERSION=$(grep -o '".*"' pyprobe/_version.py | sed 's/"//g')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Install uv & dependencies
uses: astral-sh/setup-uv@v5
with:
# Install a specific version of uv.
version: "0.6.3"

- name: Build distribution packages
run: |
uv sync --all-extras
uv build
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.extract-version.outputs.version }}
body_path: CHANGELOG.md
draft: false
prerelease: false
make_latest: true
files: |
dist/*.tar.gz
dist/*.whl
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 6320b23

Please sign in to comment.