v0.0.4 #8
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: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
task: | |
type: choice | |
options: [release, test-release] | |
default: release | |
description: Release to PyPI or TestPyPI. | |
permissions: | |
contents: read | |
jobs: | |
test: | |
uses: ./.github/workflows/test.yml | |
build: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Build | |
run: | | |
pip install build | |
python -m build | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: dist/ | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
# For pypi trusted publishing | |
id-token: write | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Get build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
path: dist | |
- name: Publish to PyPi or TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true | |
verbose: true | |
repository-url: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.task == 'test-release' && 'https://test.pypi.org/legacy/' || '' }} |