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
59 changes: 59 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Publish Python specification package

on:
workflow_dispatch:
Comment on lines +3 to +4

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restrict publishing to a protected release tag

A default dispatch checks out main and publishes its currently unreleased 0.2.1 artifact without requiring the protected v0.2.1 tag mandated by ROADMAP.md:88-92 and VERSIONING.md:31. This also permits selecting another branch: gh workflow run --help documents --ref as the “Branch or tag name which contains the version of the workflow file” (upstream manual). Consequently, an approved run from an untagged or modified ref can publish bytes that never passed the tag-based release gate; reject non-release-tag refs and validate that the tag matches the package version before granting the publish job OIDC access.

Useful? React with 👍 / 👎.


permissions:
contents: read

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

steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.13"

- name: Build distribution
run: |
python -m pip install --upgrade pip
python -m pip install build twine
python -m build

- name: Verify distribution metadata
run: python -m twine check dist/*

- name: Store distribution artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: python-package-distributions
path: dist/
if-no-files-found: error

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

steps:
- name: Download distribution artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: python-package-distributions
path: dist/

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2