PyPI release π π¦ #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PyPI release π π¦ | |
on: | |
push: | |
tags: | |
- 'v*' | |
- '!v1.*' | |
- '!v2.*' | |
- '!v3.0.*' | |
- '!v3.1.*' | |
- '!*\+docs' | |
env: | |
TZ: Europe/Zurich | |
PYTHON_VERSION: '3.12' | |
NODE_VERSION: '22.x' | |
jobs: | |
build: | |
name: Build package π¦ | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
name: Set up Python π | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: pip | |
cache-dependency-path: | | |
requirements.txt | |
requirements.dev.txt | |
- name: Install build deps π§ | |
run: | | |
sudo apt-get install libpq-dev | |
pip install --user -U pip setuptools wheel | |
- name: Check version π | |
run: python .github/utils/check_version.py "${GITHUB_REF#refs/tags/v}" | |
- name: Extract changelog π | |
run: python .github/utils/extract_changelog.py "${GITHUB_REF#refs/tags/v}" /tmp/changelog.md | |
- uses: actions/setup-node@v4 | |
name: Setup Node | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install Indico + Python deps π§ | |
run: pip install --user -e '.[dev]' | |
- name: Install npm deps β | |
run: npm ci | |
- name: Build wheel π | |
run: ./bin/maintenance/build-wheel.py indico | |
- uses: actions/upload-artifact@v4 | |
name: Upload build artifacts π¦ | |
with: | |
name: indico-wheel | |
retention-days: 7 | |
path: ./dist | |
- uses: actions/upload-artifact@v4 | |
name: Store Markdown changelog π | |
with: | |
name: changelog | |
retention-days: 7 | |
path: /tmp/changelog.md | |
create-github-release: | |
name: Create GitHub release π | |
# Upload wheel to a GitHub release. It remains available as a build artifact for a while as well. | |
needs: build | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
name: Download build artifacts π¦ | |
- name: Create draft release π | |
run: >- | |
gh release create | |
--draft | |
--repo ${{ github.repository }} | |
--title ${{ github.ref_name }} | |
--notes-file changelog/changelog.md | |
${{ github.ref_name }} | |
indico-wheel/* | |
env: | |
GH_TOKEN: ${{ github.token }} | |
publish-pypi: | |
name: Publish π | |
needs: build | |
# Wait for approval before attempting to upload to PyPI. This allows reviewing the | |
# files in the draft release. | |
environment: publish | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
# Try uploading to Test PyPI first, in case something fails. | |
- name: Publish to Test PyPI π§ͺ | |
uses: pypa/[email protected] | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
packages-dir: indico-wheel/ | |
attestations: false | |
- name: Publish to PyPI π | |
uses: pypa/[email protected] | |
with: | |
packages-dir: indico-wheel/ | |
- name: Publish GitHub release π | |
run: >- | |
gh release edit | |
--draft=false | |
--repo ${{ github.repository }} | |
${{ github.ref_name }} | |
env: | |
GH_TOKEN: ${{ github.token }} |