Skip to content

Merge pull request #21 from himewel/release/v0.0.8 #54

Merge pull request #21 from himewel/release/v0.0.8

Merge pull request #21 from himewel/release/v0.0.8 #54

Workflow file for this run

name: Release artifacts
on:
push:
branches:
- main
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build Python distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.12"
- name: Build distributions
run: uv build
- name: Upload workflow artifact (main or v* tag)
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v4
with:
name: python-dist
path: dist/*
- name: Publish GitHub Release (v* tags only)
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.whl
dist/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-pypi:
name: Publish to PyPI
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment: pypi
permissions:
contents: read
steps:
- name: Download built distributions
uses: actions/download-artifact@v4
with:
name: python-dist
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
deploy-docs:
name: Deploy docs to GitHub Pages
needs: build
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.12"
- name: Install docs dependencies
run: uv pip install -e ".[docs]"
- name: Fetch gh-pages history for mike
run: git fetch origin gh-pages --depth=1 || true
- name: Deploy versioned docs
run: |
git config user.name github-actions
git config user.email github-actions@github.com
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
mike deploy --push "$GITHUB_REF_NAME"
else
# "latest" is an alias in versions.json; deploy version "main" and move the alias (needs --update-aliases).
mike deploy --push --update-aliases main latest
mike set-default --push latest
fi