Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Release

on:
push:
tags:
- "v*"
Comment on lines +5 to +6

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enforce tag/version consistency before publishing

When any v* tag is pushed, this workflow builds and publishes the static version declared in pyproject.toml (0.1.0 currently) without checking that it matches the tag. If a maintainer pushes v0.2.0 before bumping the project metadata, PyPI will receive the old version and the GitHub release for v0.2.0 will attach artifacts named for 0.1.0; add a pre-publish check comparing ${GITHUB_REF_NAME#v} to the built package metadata version or derive the version from the tag.

Useful? React with 👍 / 👎.


permissions:
contents: write
id-token: write

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install build tooling
run: python -m pip install --upgrade build

- name: Build package
run: python -m build

- name: Upload distribution artifacts
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/*

publish-pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/tempolocus
permissions:
id-token: write

steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: Create GitHub release
needs: publish-pypi
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
files: dist/*
Loading