Last fixes before release #13
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: Create Release | |
on: | |
pull_request: | |
# Limit to closed PR targeting main and modifying the pyproject.toml | |
types: [ closed ] | |
branches: [ main ] | |
paths: [ pyproject.toml ] | |
jobs: | |
create-release-build-and-publish: | |
# Limit to merged PR that comes from a release/v branch | |
if: (github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/v')) | |
environment: publish | |
name: Create Release, Build & Publish to pypi | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.WIRG_PAT_FOR_RELEASE }} | |
- uses: ./.github/workflows/actions/install_dependencies | |
- name: export release-data | |
id: release-data | |
run: | | |
export RELEASE="v$(poetry version --short)" | |
echo "version=${RELEASE}" >> $GITHUB_OUTPUT | |
- name: Build | |
run: poetry build -n | |
- name: Check Version | |
id: check-prerelease | |
run: | | |
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || echo prerelease_flag="--prerelease" >> $GITHUB_OUTPUT | |
- name: Tag "${{ steps.release-data.outputs.version }}" & Push | |
run: | | |
git tag ${{ steps.release-data.outputs.version }} | |
git push origin ${{ steps.release-data.outputs.version }} | |
- name: Create Release | |
run: gh release create ${{ steps.release-data.outputs.version }} --generate-notes ${{ steps.check-prerelease.outputs.prerelease_flag }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload artifacts | |
run: | | |
gh release upload ${{ steps.release-data.outputs.version }} dist/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish | |
run: poetry publish -n --username __token__ --password ${{ secrets.PYPI_TOKEN }} |