-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release workflow: Use Python package version instead of manual input
CMK-18197
- Loading branch information
Showing
1 changed file
with
32 additions
and
30 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -22,6 +14,7 @@ | |
environment: release | ||
permissions: | ||
id-token: write | ||
contents: write | ||
needs: [tests] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -35,26 +28,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/[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: ${{ 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/[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 |