Skip to content

build: 🔧 update package metadata, including adding Joel and ci… #167

build: 🔧 update package metadata, including adding Joel and ci…

build: 🔧 update package metadata, including adding Joel and ci… #167

name: Release package
on:
push:
branches:
- main
# Limit token permissions for security
permissions: read-all
jobs:
release:
# This job outputs env variables `previous_version` and `current_version`.
# Only give permissions for this job.
permissions:
contents: write
uses: seedcase-project/.github/.github/workflows/reusable-release-project.yml@main
with:
app-id: ${{ vars.UPDATE_VERSION_APP_ID }}
secrets:
update-version-gh-token: ${{ secrets.UPDATE_VERSION_TOKEN }}
pypi-publish:
name: Publish to PyPI
runs-on: ubuntu-latest
# Only give permissions for this job.
permissions:
# IMPORTANT: mandatory for trusted publishing.
id-token: write
environment:
name: pypi
needs:
- release
if: ${{ needs.release.outputs.previous_version != needs.release.outputs.current_version }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
# Need to explicitly get the current version, otherwise it defaults to current commit
# (which is not the same as the release/version commit).
ref: ${{ needs.release.outputs.current_version }}
# This workflow and the publish workflows are based on:
# - https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
# - https://www.andrlik.org/dispatches/til-use-uv-for-build-and-publish-github-actions/
# - https://github.com/astral-sh/trusted-publishing-examples
- name: Set up uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
- name: Build distributions
# Builds dists from source and stores them in the dist/ directory.
run: uv build
- name: Publish 📦 to PyPI
# Only publish if the option is explicitly set in the calling workflow.
run: uv publish --trusted-publishing always