[pre-commit.ci] pre-commit autoupdate #6
Workflow file for this run
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: "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 | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history | |
ref: main # Correct branch reference | |
- 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 | |
uses: astral-sh/setup-uv@v5 | |
with: | |
# Install a specific version of uv. | |
version: "0.6.3" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: "pyproject.toml" | |
- name: Build distribution packages | |
run: | | |
uv sync --all-extras --frozen | |
uv build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
retention-days: 5 # Keep artifacts for 5 days | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: v${{ steps.extract-version.outputs.version }} | |
generate_release_notes: true | |
draft: false | |
prerelease: false | |
make_latest: true | |
files: | | |
dist/*.tar.gz | |
dist/*.whl | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish | |
run: uv publish --trusted-publishing always |