From b387309993543ac70e7f6c86412bd3518c038e39 Mon Sep 17 00:00:00 2001 From: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com> Date: Sat, 28 Mar 2026 00:10:03 +0100 Subject: [PATCH 1/4] fix: allow non-action manual set without current version --- .../reusable-manual-update-version.yml | 66 ++++++++++++++----- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/.github/workflows/reusable-manual-update-version.yml b/.github/workflows/reusable-manual-update-version.yml index dfe48dd..fba78f1 100644 --- a/.github/workflows/reusable-manual-update-version.yml +++ b/.github/workflows/reusable-manual-update-version.yml @@ -96,24 +96,6 @@ jobs: ;; esac else - current=$(task version:get 2>/dev/null || true) - if [ -z "${current}" ] && [ -f .version ]; then - current=$(tr -d '\n' < .version) - fi - if [ -z "${current}" ]; then - echo "Current version not found" - exit 1 - fi - - no_v=${current#v} - major=$(echo "${no_v}" | awk -F. '{print $1}') - minor=$(echo "${no_v}" | awk -F. '{print $2}') - patch=$(echo "${no_v}" | awk -F. '{print $3}') - if [ -z "${major}" ] || [ -z "${minor}" ] || [ -z "${patch}" ]; then - echo "Invalid current version: ${current}" - exit 1 - fi - case "${BUMP_TYPE}" in set) if [ -z "${INPUT_VERSION}" ]; then @@ -123,12 +105,60 @@ jobs: next="${INPUT_VERSION}" ;; patch) + current=$(task version:get 2>/dev/null || true) + if [ -z "${current}" ] && [ -f .version ]; then + current=$(tr -d '\n' < .version) + fi + if [ -z "${current}" ]; then + echo "Current version not found" + exit 1 + fi + no_v=${current#v} + major=$(echo "${no_v}" | awk -F. '{print $1}') + minor=$(echo "${no_v}" | awk -F. '{print $2}') + patch=$(echo "${no_v}" | awk -F. '{print $3}') + if [ -z "${major}" ] || [ -z "${minor}" ] || [ -z "${patch}" ]; then + echo "Invalid current version: ${current}" + exit 1 + fi next="v${major}.${minor}.$((patch + 1))" ;; minor) + current=$(task version:get 2>/dev/null || true) + if [ -z "${current}" ] && [ -f .version ]; then + current=$(tr -d '\n' < .version) + fi + if [ -z "${current}" ]; then + echo "Current version not found" + exit 1 + fi + no_v=${current#v} + major=$(echo "${no_v}" | awk -F. '{print $1}') + minor=$(echo "${no_v}" | awk -F. '{print $2}') + patch=$(echo "${no_v}" | awk -F. '{print $3}') + if [ -z "${major}" ] || [ -z "${minor}" ] || [ -z "${patch}" ]; then + echo "Invalid current version: ${current}" + exit 1 + fi next="v${major}.$((minor + 1)).0" ;; major) + current=$(task version:get 2>/dev/null || true) + if [ -z "${current}" ] && [ -f .version ]; then + current=$(tr -d '\n' < .version) + fi + if [ -z "${current}" ]; then + echo "Current version not found" + exit 1 + fi + no_v=${current#v} + major=$(echo "${no_v}" | awk -F. '{print $1}') + minor=$(echo "${no_v}" | awk -F. '{print $2}') + patch=$(echo "${no_v}" | awk -F. '{print $3}') + if [ -z "${major}" ] || [ -z "${minor}" ] || [ -z "${patch}" ]; then + echo "Invalid current version: ${current}" + exit 1 + fi next="v$((major + 1)).0.0" ;; *) From 66dc312a5c33eedbd06936568c58f8873d8bbadf Mon Sep 17 00:00:00 2001 From: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com> Date: Sat, 28 Mar 2026 00:23:49 +0100 Subject: [PATCH 2/4] refactor: simplify non-action version bump parsing --- .../reusable-manual-update-version.yml | 96 ++++++++----------- 1 file changed, 42 insertions(+), 54 deletions(-) diff --git a/.github/workflows/reusable-manual-update-version.yml b/.github/workflows/reusable-manual-update-version.yml index fba78f1..6483e28 100644 --- a/.github/workflows/reusable-manual-update-version.yml +++ b/.github/workflows/reusable-manual-update-version.yml @@ -96,70 +96,58 @@ jobs: ;; esac else + normalize_and_validate_version() { + local input="$1" + local candidate + candidate="${input#v}" + if ! printf "%s" "${candidate}" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then + return 1 + fi + printf "v%s" "${candidate}" + } + + get_current_version() { + local current + current=$(task version:get 2>/dev/null || true) + if [ -z "${current}" ] && [ -f .version ]; then + current=$(tr -d '\n' < .version) + fi + if [ -z "${current}" ]; then + return 1 + fi + normalize_and_validate_version "${current}" + } + case "${BUMP_TYPE}" in set) if [ -z "${INPUT_VERSION}" ]; then echo "Missing version for type=set" exit 1 fi - next="${INPUT_VERSION}" - ;; - patch) - current=$(task version:get 2>/dev/null || true) - if [ -z "${current}" ] && [ -f .version ]; then - current=$(tr -d '\n' < .version) - fi - if [ -z "${current}" ]; then - echo "Current version not found" - exit 1 - fi - no_v=${current#v} - major=$(echo "${no_v}" | awk -F. '{print $1}') - minor=$(echo "${no_v}" | awk -F. '{print $2}') - patch=$(echo "${no_v}" | awk -F. '{print $3}') - if [ -z "${major}" ] || [ -z "${minor}" ] || [ -z "${patch}" ]; then - echo "Invalid current version: ${current}" + next=$(normalize_and_validate_version "${INPUT_VERSION}") || { + echo "Invalid explicit version: ${INPUT_VERSION}. Expected vX.Y.Z or X.Y.Z" exit 1 - fi - next="v${major}.${minor}.$((patch + 1))" + } ;; - minor) - current=$(task version:get 2>/dev/null || true) - if [ -z "${current}" ] && [ -f .version ]; then - current=$(tr -d '\n' < .version) - fi - if [ -z "${current}" ]; then - echo "Current version not found" + patch|minor|major) + current=$(get_current_version) || { + echo "Current version not found or invalid. Expected vX.Y.Z" exit 1 - fi + } no_v=${current#v} - major=$(echo "${no_v}" | awk -F. '{print $1}') - minor=$(echo "${no_v}" | awk -F. '{print $2}') - patch=$(echo "${no_v}" | awk -F. '{print $3}') - if [ -z "${major}" ] || [ -z "${minor}" ] || [ -z "${patch}" ]; then - echo "Invalid current version: ${current}" - exit 1 - fi - next="v${major}.$((minor + 1)).0" - ;; - major) - current=$(task version:get 2>/dev/null || true) - if [ -z "${current}" ] && [ -f .version ]; then - current=$(tr -d '\n' < .version) - fi - if [ -z "${current}" ]; then - echo "Current version not found" - exit 1 - fi - no_v=${current#v} - major=$(echo "${no_v}" | awk -F. '{print $1}') - minor=$(echo "${no_v}" | awk -F. '{print $2}') - patch=$(echo "${no_v}" | awk -F. '{print $3}') - if [ -z "${major}" ] || [ -z "${minor}" ] || [ -z "${patch}" ]; then - echo "Invalid current version: ${current}" - exit 1 - fi - next="v$((major + 1)).0.0" + IFS='.' read -r major minor patch <<< "${no_v}" + + case "${BUMP_TYPE}" in + patch) + next="v${major}.${minor}.$((patch + 1))" + ;; + minor) + next="v${major}.$((minor + 1)).0" + ;; + major) + next="v$((major + 1)).0.0" + ;; + esac ;; *) echo "Unknown type: ${BUMP_TYPE}" From de57152e2a1984538891306421ea1ab7f5ceece9 Mon Sep 17 00:00:00 2001 From: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com> Date: Sat, 28 Mar 2026 00:35:06 +0100 Subject: [PATCH 3/4] feat: support release mode in manual version workflow --- .github/workflows/manual-update-version.yml | 6 +++ .../reusable-manual-update-version.yml | 41 +++++++++++++++++-- .../workflows/manual-update-version.yml | 5 +++ .../other/workflows/manual-update-version.yml | 5 +++ 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/.github/workflows/manual-update-version.yml b/.github/workflows/manual-update-version.yml index ff3727e..a3ee886 100644 --- a/.github/workflows/manual-update-version.yml +++ b/.github/workflows/manual-update-version.yml @@ -22,6 +22,11 @@ on: required: false default: false type: boolean + create_release: + description: Create release tags and publish GitHub release + required: false + default: true + type: boolean permissions: contents: write @@ -37,5 +42,6 @@ jobs: bump-type: ${{ inputs.type }} explicit-version: ${{ inputs.version }} build-and-push-only: ${{ inputs.build_only }} + publish-release: ${{ inputs.create_release }} profile: other docker-platforms: amd64,arm64 diff --git a/.github/workflows/reusable-manual-update-version.yml b/.github/workflows/reusable-manual-update-version.yml index 6483e28..34faf0e 100644 --- a/.github/workflows/reusable-manual-update-version.yml +++ b/.github/workflows/reusable-manual-update-version.yml @@ -24,6 +24,10 @@ on: description: Skip version update and only build/push artifacts type: boolean default: false + publish-release: + description: Create release tags and publish GitHub release instead of opening PR + type: boolean + default: false profile: description: Repository profile (actions, dockerized, other, static) type: string @@ -191,7 +195,7 @@ jobs: run: echo "Build-only mode requested with docker disabled; skipping image build/push" - name: Get template - if: ${{ !inputs.build-and-push-only }} + if: ${{ !inputs.build-and-push-only && !inputs.publish-release }} env: VERSION_SUFFIX: "" run: | @@ -199,7 +203,7 @@ jobs: task git:get-pr-template - name: Push to release branch - if: ${{ !inputs.build-and-push-only }} + if: ${{ !inputs.build-and-push-only && !inputs.publish-release }} uses: devops-infra/action-commit-push@v1 with: github_token: ${{ github.token }} @@ -207,7 +211,7 @@ jobs: target_branch: ${{ format('release/{0}', steps.version.outputs.REL_VERSION) }} - name: Create Pull Request - if: ${{ !inputs.build-and-push-only }} + if: ${{ !inputs.build-and-push-only && !inputs.publish-release }} uses: devops-infra/action-pull-request@v1 with: github_token: ${{ github.token }} @@ -215,6 +219,37 @@ jobs: template: .tmp/PULL_REQUEST_TEMPLATE.md get_diff: true + - name: Create and push release tags + if: ${{ !inputs.build-and-push-only && inputs.publish-release }} + env: + VERSION: ${{ steps.version.outputs.REL_VERSION }} + run: | + set -eux + version_no_v="${VERSION#v}" + major="v$(echo "${version_no_v}" | awk -F. '{print $1}')" + minor="v$(echo "${version_no_v}" | awk -F. '{print $1"."$2}')" + + if git ls-remote --tags origin "refs/tags/${VERSION}" | grep -q .; then + echo "Release tag ${VERSION} already exists on origin" + exit 1 + fi + + git tag --annotate "${VERSION}" --message "${VERSION}" + git push origin "refs/tags/${VERSION}" + + git tag --force --annotate "${minor}" --message "${VERSION}" + git push --force origin "refs/tags/${minor}" + + git tag --force --annotate "${major}" --message "${VERSION}" + git push --force origin "refs/tags/${major}" + + - name: Create GitHub release + if: ${{ !inputs.build-and-push-only && inputs.publish-release }} + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.version.outputs.REL_VERSION }} + generate_release_notes: true + - name: Export version output id: export-version run: | diff --git a/templates/dockerized/workflows/manual-update-version.yml b/templates/dockerized/workflows/manual-update-version.yml index f8717de..bbffa72 100644 --- a/templates/dockerized/workflows/manual-update-version.yml +++ b/templates/dockerized/workflows/manual-update-version.yml @@ -24,6 +24,10 @@ on: description: Skip version update and only build/push artifacts type: boolean default: false + publish-release: + description: Create release tags and publish GitHub release + type: boolean + default: true docker-platforms: description: Docker platforms to build for when build-only mode is enabled type: string @@ -45,6 +49,7 @@ jobs: bump-type: ${{ inputs.bump-type }} explicit-version: ${{ inputs.explicit-version }} build-and-push-only: ${{ inputs.build-and-push-only }} + publish-release: ${{ inputs.publish-release }} profile: dockerized docker-platforms: ${{ inputs.docker-platforms }} secrets: diff --git a/templates/other/workflows/manual-update-version.yml b/templates/other/workflows/manual-update-version.yml index e9a8f0b..31c21b8 100644 --- a/templates/other/workflows/manual-update-version.yml +++ b/templates/other/workflows/manual-update-version.yml @@ -24,6 +24,10 @@ on: description: Skip version update and only build/push artifacts type: boolean default: false + publish-release: + description: Create release tags and publish GitHub release + type: boolean + default: true docker-platforms: description: Docker platforms to build for when build-only mode is enabled type: string @@ -42,5 +46,6 @@ jobs: bump-type: ${{ inputs.bump-type }} explicit-version: ${{ inputs.explicit-version }} build-and-push-only: ${{ inputs.build-and-push-only }} + publish-release: ${{ inputs.publish-release }} profile: other docker-platforms: ${{ inputs.docker-platforms }} From 6c1c4b1630a1b60a604c214b3de5f094e6034bc5 Mon Sep 17 00:00:00 2001 From: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com> Date: Sat, 28 Mar 2026 00:39:50 +0100 Subject: [PATCH 4/4] refactor: make manual release behavior implicit by build-only flag --- .github/workflows/manual-update-version.yml | 6 ---- .../reusable-manual-update-version.yml | 33 ++----------------- .../workflows/manual-update-version.yml | 5 --- .../other/workflows/manual-update-version.yml | 5 --- 4 files changed, 2 insertions(+), 47 deletions(-) diff --git a/.github/workflows/manual-update-version.yml b/.github/workflows/manual-update-version.yml index a3ee886..ff3727e 100644 --- a/.github/workflows/manual-update-version.yml +++ b/.github/workflows/manual-update-version.yml @@ -22,11 +22,6 @@ on: required: false default: false type: boolean - create_release: - description: Create release tags and publish GitHub release - required: false - default: true - type: boolean permissions: contents: write @@ -42,6 +37,5 @@ jobs: bump-type: ${{ inputs.type }} explicit-version: ${{ inputs.version }} build-and-push-only: ${{ inputs.build_only }} - publish-release: ${{ inputs.create_release }} profile: other docker-platforms: amd64,arm64 diff --git a/.github/workflows/reusable-manual-update-version.yml b/.github/workflows/reusable-manual-update-version.yml index 34faf0e..96fd994 100644 --- a/.github/workflows/reusable-manual-update-version.yml +++ b/.github/workflows/reusable-manual-update-version.yml @@ -24,10 +24,6 @@ on: description: Skip version update and only build/push artifacts type: boolean default: false - publish-release: - description: Create release tags and publish GitHub release instead of opening PR - type: boolean - default: false profile: description: Repository profile (actions, dockerized, other, static) type: string @@ -194,33 +190,8 @@ jobs: if: ${{ inputs.build-and-push-only && inputs.profile != 'actions' && inputs.profile != 'dockerized' }} run: echo "Build-only mode requested with docker disabled; skipping image build/push" - - name: Get template - if: ${{ !inputs.build-and-push-only && !inputs.publish-release }} - env: - VERSION_SUFFIX: "" - run: | - task git:set-config - task git:get-pr-template - - - name: Push to release branch - if: ${{ !inputs.build-and-push-only && !inputs.publish-release }} - uses: devops-infra/action-commit-push@v1 - with: - github_token: ${{ github.token }} - commit_message: ":rocket: Bump version to ${{ steps.version.outputs.REL_VERSION }}" - target_branch: ${{ format('release/{0}', steps.version.outputs.REL_VERSION) }} - - - name: Create Pull Request - if: ${{ !inputs.build-and-push-only && !inputs.publish-release }} - uses: devops-infra/action-pull-request@v1 - with: - github_token: ${{ github.token }} - assignee: ${{ github.actor }} - template: .tmp/PULL_REQUEST_TEMPLATE.md - get_diff: true - - name: Create and push release tags - if: ${{ !inputs.build-and-push-only && inputs.publish-release }} + if: ${{ !inputs.build-and-push-only }} env: VERSION: ${{ steps.version.outputs.REL_VERSION }} run: | @@ -244,7 +215,7 @@ jobs: git push --force origin "refs/tags/${major}" - name: Create GitHub release - if: ${{ !inputs.build-and-push-only && inputs.publish-release }} + if: ${{ !inputs.build-and-push-only }} uses: softprops/action-gh-release@v2 with: tag_name: ${{ steps.version.outputs.REL_VERSION }} diff --git a/templates/dockerized/workflows/manual-update-version.yml b/templates/dockerized/workflows/manual-update-version.yml index bbffa72..f8717de 100644 --- a/templates/dockerized/workflows/manual-update-version.yml +++ b/templates/dockerized/workflows/manual-update-version.yml @@ -24,10 +24,6 @@ on: description: Skip version update and only build/push artifacts type: boolean default: false - publish-release: - description: Create release tags and publish GitHub release - type: boolean - default: true docker-platforms: description: Docker platforms to build for when build-only mode is enabled type: string @@ -49,7 +45,6 @@ jobs: bump-type: ${{ inputs.bump-type }} explicit-version: ${{ inputs.explicit-version }} build-and-push-only: ${{ inputs.build-and-push-only }} - publish-release: ${{ inputs.publish-release }} profile: dockerized docker-platforms: ${{ inputs.docker-platforms }} secrets: diff --git a/templates/other/workflows/manual-update-version.yml b/templates/other/workflows/manual-update-version.yml index 31c21b8..e9a8f0b 100644 --- a/templates/other/workflows/manual-update-version.yml +++ b/templates/other/workflows/manual-update-version.yml @@ -24,10 +24,6 @@ on: description: Skip version update and only build/push artifacts type: boolean default: false - publish-release: - description: Create release tags and publish GitHub release - type: boolean - default: true docker-platforms: description: Docker platforms to build for when build-only mode is enabled type: string @@ -46,6 +42,5 @@ jobs: bump-type: ${{ inputs.bump-type }} explicit-version: ${{ inputs.explicit-version }} build-and-push-only: ${{ inputs.build-and-push-only }} - publish-release: ${{ inputs.publish-release }} profile: other docker-platforms: ${{ inputs.docker-platforms }}