Skip to content

Release 0.1.9

Release 0.1.9 #7

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Extract CHANGELOG for this version
id: changelog
run: |
VERSION="${GITHUB_REF_NAME#v}"
# Prefer ## [0.1.0] / ## [1.2.3]; fall back to Unreleased notes if missing.
{
awk "/^## \[$VERSION\]/{found=1; next} /^## \[/{if(found) exit} found{print}" CHANGELOG.md
} > release_notes.txt
if [ ! -s release_notes.txt ]; then
awk '/^## \[Unreleased\]/{found=1; next} /^## \[/{if(found) exit} found{print}' CHANGELOG.md > release_notes.txt
fi
if [ ! -s release_notes.txt ]; then
echo "See CHANGELOG.md for details." > release_notes.txt
fi
{
echo "notes<<EOF"
cat release_notes.txt
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Build sdist + wheel
run: uv build
- name: Generate SBOM (CycloneDX)
run: |
set -euo pipefail
# Keep SBOM out of dist/ — pypa/gh-action-pypi-publish uploads everything there.
mkdir -p sbom
uv sync --extra sdk
uvx --from cyclonedx-bom==6.1.2 \
cyclonedx-py environment \
--pyproject pyproject.toml \
--mc-type library \
--output-format JSON \
--output-file "sbom/sbom-${GITHUB_REF_NAME}.cdx.json" \
--output-reproducible
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.changelog.outputs.notes }}
draft: false
prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-beta') || contains(github.ref_name, '-alpha') }}
files: |
dist/*.whl
dist/*.tar.gz
sbom/sbom-*.cdx.json
# PyPI only from the public release repo (not streamlit-coco-dev).
# Temporary: lletourmy/streamlit-coco until DevoteamSP org is PyPI-validated;
# switch Trusted Publisher + this gate back to DevoteamSP/streamlit-coco after.
- name: Publish to PyPI
if: >-
github.repository == 'lletourmy/streamlit-coco'
&& !contains(github.ref_name, '-rc')
&& !contains(github.ref_name, '-beta')
&& !contains(github.ref_name, '-alpha')
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/