Skip to content

Build

Build #113

Workflow file for this run

# Runs a build test on commit to ensure functionality.
name: Build
on:
push:
tags:
- "*.*.*"
workflow_run:
workflows: ["Type Coverage and Linting"]
types: [completed]
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
name: "Build"
steps:
- name: "Checkout Repository"
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
python-version: "3.13"
activate-environment: true
- name: "Install deps"
run: |
uv sync --locked --all-extras --all-groups --no-dev
- name: "Check it imports"
run: |
uv run python -c 'import mystbin'
- name: "Build wheels"
run: |
uv build
- name: "Build docs"
working-directory: docs/
run: |
uv run sphinx-build -aEWT --keep-going ./ ./build
- name: "Upload artifacts"
uses: actions/upload-artifact@v5
with:
name: distributions
path: dist/*
# Credits to most of this step go to Gorialis (Devon R [https://github.com/Gorialis])
# as I found them in their Jishaku builds (https://github.com/Gorialis/jishaku/blob/d3f50749b5a977b544e5fd14894585f656247486/.github/workflows/deploy.yml#L82-L119)
create_release:
name: Create Release
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: true
- name: Download Artifacts
uses: actions/download-artifact@v6
with:
name: distributions
path: dist
- name: Create GitHub release
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
assets=()
for asset in ./dist/*.{whl,tar.gz}; do
assets+=("$asset")
done
tag_name="${GITHUB_REF##*/}"
gh release create "$tag_name" -F "CHANGELOG.md" "${assets[@]}"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.13"
activate-environment: true
- name: Publish to PyPI
run: |
uv publish