Skip to content

Changes

Changes #61

Workflow file for this run

name: Build and Publish Wheels
on:
push:
branches:
- main
- 13-remove-zig
release:
types: [published]
workflow_dispatch: # Allows manual triggering
jobs:
build_wheels:
name: Build wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # Required for setuptools_scm to work
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Install build tools
run: pip install .[build]
- name: Check build version
run: python3 -m setuptools_scm
- name: Build wheel
run: python -m build
- name: Check wheel
run: |
pip install twine
twine check dist/*
- name: Install built wheel
run: pip install dist/*.whl
- name: Install maintainer requirements for testing
run: pip install .[maintainer]
- name: Run tests
run: pytest
- uses: actions/upload-artifact@v4
with:
path: dist/*.whl
retention-days: 7
# Upload to Test PyPI on every push to main
upload_test_pypi:
name: Upload to Test PyPI
needs: [build_wheels]
runs-on: ubuntu-latest
environment:
name: pypi-test
url: https://test.pypi.org/project/volt-framework/
permissions:
id-token: write
if: github.event_name == 'push'
steps:
- uses: actions/download-artifact@v4
with:
path: dist
- name: Publish to Test PyPI (Debugging)
uses: pypa/gh-action-pypi-publish@release/v1
if: runner.debug == '1'
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
verbose: true
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: runner.debug == '0'
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
# Upload to production PyPI only on releases
upload_pypi:
name: Upload to PyPI
needs: [build_wheels]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/volt-framework/
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: dist
- name: Publish to PyPI (Debugging)
uses: pypa/gh-action-pypi-publish@release/v1
if: runner.debug == '1'
with:
verbose: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: runner.debug == '0'