Skip to content

Commit

Permalink
Release workflow: Use Python package version instead of manual input
Browse files Browse the repository at this point in the history
CMK-18197
  • Loading branch information
jherbel committed Jul 16, 2024
1 parent fc7efb6 commit b281fa9
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@

---
name: "Release"
on:
workflow_dispatch:
inputs:
tag:
description: >
Tag set by this GitHub workflow.
Should follow SemVer and is not allowed to exist already.
required: true
type: string
on: workflow_dispatch

jobs:
tests:
Expand All @@ -35,13 +27,19 @@
- 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 ${{ inputs.tag }} # Fails, if tag exists.
git push origin ${{ inputs.tag }}
git tag ${{ steps.compute-tag.outputs.TAG }} # Fails, if tag exists.
git push origin ${{ steps.compute-tag.outputs.TAG }}
- uses: ncipollo/[email protected]
with:
Expand All @@ -55,6 +53,6 @@
artifactErrorsFailBuild: true
updateOnlyUnreleased: true
makeLatest: false
tag: ${{ inputs.tag }}
tag: ${{ steps.compute-tag.outputs.TAG }}

- uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit b281fa9

Please sign in to comment.