Skip to content

comlink-python release #45

comlink-python release

comlink-python release #45

Workflow file for this run

name: comlink-python release
on:
workflow_dispatch:
jobs:
release:
name: Semantic Release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
concurrency:
group: ${{ github.workflow }}-release-${{ github.ref_name }}
cancel-in-progress: false
environment:
name: pypi
url: https://pypi.org/project/swgoh-comlink/
permissions:
id-token: write
contents: write
steps:
- name: Check-out repository
uses: actions/checkout@v6
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
# Update version
- name: Update version
run: uvx hatch version minor
# Update CHANGELOG.md
- name: Update CHANGELOG.md
run: uvx git-changelog -B auto -Tio CHANGELOG.md -c angular -s build,deps,fix,feat,refactor -n semver
# Commit version bump and changelog, then tag and push
- name: Commit and tag
run: |
VERSION=$(uvx hatch version)
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add src/swgoh_comlink/version.py CHANGELOG.md
git commit -m "chore(release): bump version to $VERSION [skip ci]"
git tag -a "v$VERSION" -m "Release version $VERSION"
git push origin ${{ github.ref_name }} --follow-tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Build the package
- name: Build the package
run: uvx hatch build
# Upload build artifacts for the publish job
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
# Publish the package to PyPI
pypi-publish:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs:
- release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
contents: write
environment:
name: pypi
url: https://pypi.org/project/swgoh-comlink/
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0