From e094cd7b763772573a7e85cba44fda4489fc441f Mon Sep 17 00:00:00 2001 From: Joerg Herbel Date: Tue, 16 Jul 2024 12:11:51 +0200 Subject: [PATCH] Release workflow: Use Python package version instead of manual input CMK-18197 --- .github/workflows/release.yaml | 61 +++++++++++++++++----------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 14e3d27..5647ac0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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: @@ -35,26 +27,35 @@ - run: poetry build - run: tar --create --gzip --verbose --file dist.tar.gz dist - - - name: "Push release tag" - # This is publicly visible and needs to be manually fixed if any - # consecutive step fails. + + - name: "Set release according to package version" + id: compute-tag run: | - git tag ${{ inputs.tag }} # Fails, if tag exists. - git push origin ${{ inputs.tag }} + version="$(poetry version | cut --delimiter " " --fields 2)" + echo "TAG=v${version}" >> "${GITHUB_OUTPUT}" - - uses: ncipollo/release-action@v1.13.0 - with: - allowUpdates: false - artifacts: "dist.tar.gz" - replacesArtifacts: true - removeArtifacts: true - prerelease: true - draft: true - body: "" - artifactErrorsFailBuild: true - updateOnlyUnreleased: true - makeLatest: false - tag: ${{ inputs.tag }} - - - uses: pypa/gh-action-pypi-publish@release/v1 + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + + # - 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/release-action@v1.13.0 + # 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