Skip to content

Release

Release #7

Workflow file for this run

# Note: The name of this file and the name of the used environment must match the Trusted Publisher
# configuration on PyPI.
---
name: "Release"
on: workflow_dispatch
jobs:
tests:
uses: ./.github/workflows/tests.yaml
release:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: write
needs: [tests]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- run: python3 -m pip install poetry
- run: poetry build
- run: tar --create --gzip --verbose --file dist.tar.gz dist
- name: "Set release according to package version"
id: compute-tag
run: |
version="$(poetry version | cut --delimiter " " --fields 2)"
echo "TAG=v${version}" >> "${GITHUB_OUTPUT}"
- name: "Push release tag"
# This is publicly visible and needs to be manually fixed if any
# consecutive step fails.
run: |
git tag ${{ steps.compute-tag.outputs.TAG }} # Fails, if tag exists.
git push origin ${{ steps.compute-tag.outputs.TAG }}
- uses: ncipollo/[email protected]
with:
allowUpdates: false
artifacts: "dist.tar.gz"
replacesArtifacts: true
removeArtifacts: true
prerelease: true
draft: true
body: ""
artifactErrorsFailBuild: true
updateOnlyUnreleased: true
makeLatest: false
tag: ${{ steps.compute-tag.outputs.TAG }}
- uses: pypa/gh-action-pypi-publish@release/v1