Get started with top level documentation and implement little features to make example code nicer. #99
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: Release | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*.*.*' | |
pull_request: | |
jobs: | |
build: | |
name: Build Package | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Set up pixi | |
uses: prefix-dev/[email protected] | |
with: | |
environments: release | |
- name: Ensure tag matches version | |
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
version="$(pixi exec -s go-yq -- yq .project.version pyproject.toml)" | |
tag="${{ github.ref_name }}" | |
if [ "$version" != "$tag" ]; then | |
echo "Tag $tag does not match version $version" | |
exit 1 | |
fi | |
- name: Build | |
run: pixi run -e release hatch build | |
- name: Check build | |
run: pixi run -e release twine check dist/* | |
- name: List files | |
run: ls -l dist/ | |
- name: Upload package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact | |
path: dist/* | |
release: | |
name: Publish Package | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [build] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
environment: pypi | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: dist | |
- name: Publish package on TestPyPi | |
uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish package on PyPi | |
uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc |