Skip to content

Expand installer plan with technical details #367

Expand installer plan with technical details

Expand installer plan with technical details #367

Workflow file for this run

name: PyPi
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Clean previous builds
run: rm -rf dist/ build/ *.egg-info
- name: Build release distributions
run: |
python -m pip install build
python -m build
- name: Verify package with twine
run: |
python -m pip install twine
twine check dist/*
- name: Store the distribution packages
uses: actions/upload-artifact@v6
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: >-
Publish Python 🐍 distribution πŸ“¦ to PyPI
if: startsWith(github.ref, 'refs/tags/') && github.event.repository.default_branch == 'main'
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/amd-gaia
permissions:
id-token: write
contents: read # Needed for checkout
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Verify tag matches version.py
run: |
# Extract version from version.py
VERSION_PY=$(grep -oP '__version__\s*=\s*"\K[^"]+' src/gaia/version.py)
# Get tag name (strip 'v' prefix if present)
TAG_VERSION="${GITHUB_REF_NAME#v}"
echo "version.py version: $VERSION_PY"
echo "Git tag version: $TAG_VERSION"
if [ "$VERSION_PY" != "$TAG_VERSION" ]; then
echo "❌ ERROR: Version mismatch!"
echo " src/gaia/version.py has version '$VERSION_PY'"
echo " Git tag is '$TAG_VERSION'"
echo " Please update version.py to match the tag, or create the correct tag."
exit 1
fi
echo "βœ… Versions match!"
- name: Download all the dists
uses: actions/download-artifact@v7
with:
name: python-package-distributions
path: dist/
- name: Publish distribution πŸ“¦ to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: >-
Sign the Python 🐍 distribution πŸ“¦ with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: Download all the dists
uses: actions/download-artifact@v7
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.2.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
"$GITHUB_REF_NAME"
--repo "$GITHUB_REPOSITORY"
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
"$GITHUB_REF_NAME" dist/**
--repo "$GITHUB_REPOSITORY"