-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use output of --version in release workflow instead of manual input
This automatically synchronizes the version of a release with the version in Cargo.toml. In case we forget to bump the version in Cargo.toml, the release will fail since the git tag will already exist. CMK-18367
- Loading branch information
Showing
1 changed file
with
14 additions
and
13 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 |
---|---|---|
@@ -1,15 +1,6 @@ | ||
--- | ||
name: "Release" | ||
# Careful! This pushes a git tag to GitHub! The release itself is private. | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: > | ||
Tag, which is set by the this GitHub workflow. | ||
Should follow SemVer and is not allowed to exist already. | ||
required: true | ||
type: string | ||
on: workflow_dispatch | ||
|
||
jobs: | ||
tests: | ||
|
@@ -27,6 +18,10 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions-rust-lang/[email protected] | ||
with: | ||
target: x86_64-unknown-linux-gnu | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: rcc | ||
|
@@ -39,12 +34,18 @@ jobs: | |
|
||
- run: zip -r executables.zip artifact | ||
|
||
- name: "Compute release tag" | ||
id: compute-tag | ||
run: | | ||
version="$(cargo run --bin robotmk_scheduler -- --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: | ||
|
@@ -58,4 +59,4 @@ jobs: | |
artifactErrorsFailBuild: true | ||
updateOnlyUnreleased: true | ||
makeLatest: false | ||
tag: ${{ inputs.tag }} | ||
tag: ${{ steps.compute-tag.outputs.TAG }} |