From 109a8dd4ed008b7c9b5d55ac2f38ea13959ebf75 Mon Sep 17 00:00:00 2001 From: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 18 May 2026 22:55:55 +0200 Subject: [PATCH] feat: add workflow_dispatch inputs for release branch and version overrides --- .github/workflows/auto-release-create.yml | 14 ++ .../reusable-auto-release-create.yml | 42 +++- Taskfile.cicd.yml | 32 +-- Taskfile.scripts.yml | 208 ++++++++++++++++++ Taskfile.variables.yml | 147 +------------ Taskfile.yml | 11 +- .../actions/workflows/auto-release-create.yml | 14 ++ .../workflows/auto-release-create.yml | 14 ++ .../other/workflows/auto-release-create.yml | 14 ++ .../static/workflows/auto-release-create.yml | 14 ++ 10 files changed, 326 insertions(+), 184 deletions(-) create mode 100644 Taskfile.scripts.yml diff --git a/.github/workflows/auto-release-create.yml b/.github/workflows/auto-release-create.yml index 588ac44..9b61df1 100644 --- a/.github/workflows/auto-release-create.yml +++ b/.github/workflows/auto-release-create.yml @@ -5,6 +5,18 @@ on: branches: - master - main + workflow_dispatch: + inputs: + release_branch: + description: Release branch to publish from (e.g. release/v1.3.0) + required: false + default: '' + type: string + release_version: + description: Explicit release version override (e.g. v1.3.0) + required: false + default: '' + type: string permissions: contents: write @@ -17,4 +29,6 @@ jobs: runs-on: ubuntu-24.04-arm task-version: 3.x profile: other + release-branch: ${{ inputs.release_branch }} + release-version: ${{ inputs.release_version }} secrets: inherit diff --git a/.github/workflows/reusable-auto-release-create.yml b/.github/workflows/reusable-auto-release-create.yml index 9aa34e0..ec37757 100644 --- a/.github/workflows/reusable-auto-release-create.yml +++ b/.github/workflows/reusable-auto-release-create.yml @@ -15,6 +15,16 @@ on: description: Repository profile (actions, dockerized, other, static) type: string default: actions + release-branch: + description: Explicit release branch to publish from (for manual dispatch), e.g. release/v1.3.0 + type: string + required: false + default: '' + release-version: + description: Explicit release version (for manual dispatch), e.g. v1.3.0 + type: string + required: false + default: '' permissions: contents: write @@ -41,6 +51,31 @@ jobs: uses: actions/github-script@v9 with: script: | + const inputReleaseBranch = `${{ inputs.release-branch }}`.trim() + const inputReleaseVersion = `${{ inputs.release-version }}`.trim() + + const emitVersion = (branchRef, explicitVersion) => { + const rawVersion = explicitVersion || branchRef.replace(/^release\//, '') + if (!/^v\d+\.\d+\.\d+$/.test(rawVersion)) { + core.setFailed(`Resolved release version '${rawVersion}' is invalid. Expected 'vX.Y.Z'.`) + return false + } + core.setOutput('should_release', 'true') + core.setOutput('release_branch', branchRef) + core.setOutput('release_version', rawVersion) + return true + } + + if (inputReleaseBranch) { + if (!inputReleaseBranch.startsWith('release/')) { + core.setFailed(`Input release-branch '${inputReleaseBranch}' must start with 'release/'`) + return + } + core.info(`Using manual dispatch release branch '${inputReleaseBranch}'`) + emitVersion(inputReleaseBranch, inputReleaseVersion) + return + } + const owner = context.repo.owner const repo = context.repo.repo const sha = context.sha @@ -61,15 +96,14 @@ jobs: } core.info(`Matched merged release PR #${match.number} from ${match.head.ref} to ${match.base.ref}`) - core.setOutput('should_release', 'true') - core.setOutput('release_branch', match.head.ref) + emitVersion(match.head.ref, inputReleaseVersion) - - name: Resolve release version + - name: Resolve release version from release branch id: version if: steps.release-pr.outputs.should_release == 'true' run: | set -eu - version="$(task version:get)" + version='${{ steps.release-pr.outputs.release_version }}' if [ -z "$version" ]; then echo "❌ ERROR: Resolved version is empty" exit 1 diff --git a/Taskfile.cicd.yml b/Taskfile.cicd.yml index f21bc3f..cf0c65f 100644 --- a/Taskfile.cicd.yml +++ b/Taskfile.cicd.yml @@ -22,7 +22,6 @@ tasks: desc: Run all linters (Dockerfile, shell scripts, workflows, YAML) cmds: - task: lint:actionlint - - task: lint:hadolint - task: lint:shellcheck - task: lint:yamllint @@ -42,26 +41,6 @@ tasks: exit $rc fi - lint:hadolint: - desc: Lint Dockerfile with hadolint - cmds: - - | - echo "▶️ Running hadolint..." - if [ ! -f Dockerfile ]; then - echo "ℹ️ No Dockerfile found, skipping hadolint" - exit 0 - fi - set +e - docker run --rm -i -v "$PWD:/work" -w /work hadolint/hadolint:latest-debian < Dockerfile - rc=$? - set -e - if [ "$rc" -eq 0 ]; then - echo "✅ hadolint passed" - else - echo "❌ hadolint failed" - exit $rc - fi - lint:shellcheck: desc: Lint shell scripts with shellcheck shell: bash @@ -95,12 +74,8 @@ tasks: cmds: - | echo "▶️ Running yamllint..." - config_file=".yamllint.yml" - if [ ! -f "$config_file" ]; then - config_file="templates/other/configs/.yamllint.yml" - fi set +e - docker run --rm -i -v "$PWD:/work" -w /work cytopia/yamllint -c "$config_file" .github .github/workflows templates + docker run --rm -i -v "$PWD:/work" -w /work cytopia/yamllint -c .yamllint.yml . rc=$? set -e if [ "$rc" -eq 0 ]; then @@ -114,9 +89,9 @@ tasks: desc: Check main dependency not covered by dependabot cmds: - | - echo "ℹ️ No dedicated dependency updater configured for this repository." + echo "ℹ️ No dedicated dependency updater configured for this repository profile." echo "ℹ️ Dependabot handles GitHub Actions and package metadata updates." - echo "ℹ️ Keeping dependency checks as a safe no-op for now." + echo "ℹ️ Keep this task as a safe no-op until a repo-specific dependency updater is defined." version:set: desc: Validate version @@ -130,6 +105,7 @@ tasks: echo "❌ ERROR: VERSION '{{.VERSION}}' is not a valid semantic version (expected vX.Y.Z or X.Y.Z)" exit 1 fi + version:update:patch: desc: Increment patch version (e.g., 1.2.3 -> 1.2.4) cmds: diff --git a/Taskfile.scripts.yml b/Taskfile.scripts.yml new file mode 100644 index 0000000..8e71f79 --- /dev/null +++ b/Taskfile.scripts.yml @@ -0,0 +1,208 @@ +version: '3' + +silent: true + +tasks: + help: + desc: Detailed help + cmds: + - | + echo "Tasks:" + task --list + + lint:actionlint: + desc: Lint GitHub Actions workflows with actionlint + cmds: + - | + echo "▶️ Running actionlint..." + set +e + docker run --rm -i -v "$PWD:/work" -w /work rhysd/actionlint:latest -color + rc=$? + set -e + if [ "$rc" -eq 0 ]; then + echo "✅ actionlint passed" + else + echo "❌ actionlint failed" + exit $rc + fi + + lint:hadolint: + desc: Lint Dockerfile with hadolint + cmds: + - | + echo "▶️ Running hadolint..." + if [ ! -f Dockerfile ]; then + echo "ℹ️ No Dockerfile found, skipping hadolint" + exit 0 + fi + set +e + docker run --rm -i -v "$PWD:/work" -w /work hadolint/hadolint:latest-debian < Dockerfile + rc=$? + set -e + if [ "$rc" -eq 0 ]; then + echo "✅ hadolint passed" + else + echo "❌ hadolint failed" + exit $rc + fi + + lint:shellcheck: + desc: Lint shell scripts with shellcheck + shell: bash + cmds: + - | + echo "▶️ Running shellcheck..." + mapfile -t files < <(git ls-files '*.sh') + existing_files=() + for f in "${files[@]}"; do + if [ -f "$f" ]; then + existing_files+=("$f") + fi + done + if [ "${#existing_files[@]}" -eq 0 ]; then + echo "ℹ️ No shell scripts found, skipping shellcheck" + exit 0 + fi + set +e + docker run --rm -i -v "$PWD:/work" -w /work koalaman/shellcheck:stable -x -S style -- "${existing_files[@]}" + rc=$? + set -e + if [ "$rc" -eq 0 ]; then + echo "✅ shellcheck passed" + else + echo "❌ shellcheck failed" + exit $rc + fi + + lint:yamllint: + desc: Lint YAML files with yamllint + cmds: + - | + echo "▶️ Running yamllint..." + set +e + docker run --rm -i -v "$PWD:/work" -w /work cytopia/yamllint -c .yamllint.yml . + rc=$? + set -e + if [ "$rc" -eq 0 ]; then + echo "✅ yamllint passed" + else + echo "❌ yamllint failed" + exit $rc + fi + + git:get-pr-template: + desc: Get pull request template + cmds: + - mkdir -p .tmp + - curl -LsS https://raw.githubusercontent.com/devops-infra/.github/master/PULL_REQUEST_TEMPLATE.md -o .tmp/PULL_REQUEST_TEMPLATE.md + + git:set-config: + desc: Set git user config + cmds: + - git config user.name "github-actions[bot]" + - git config user.email "github-actions[bot]@users.noreply.github.com" + + version:get: + desc: Get current version + cmds: + - echo "{{.VERSION}}" + + version:set: + desc: Validate version + cmds: + - | + if [ -z "{{.VERSION}}" ]; then + echo "❌ ERROR: VERSION is empty" + exit 1 + fi + if ! echo "{{.VERSION}}" | grep -Eq '^v?[0-9]+\.[0-9]+\.[0-9]+$'; then + echo "❌ ERROR: VERSION '{{.VERSION}}' is not a valid semantic version (expected vX.Y.Z or X.Y.Z)" + exit 1 + fi + + version:update:patch: + desc: Increment patch version (e.g., 1.2.3 -> 1.2.4) + cmds: + - task version:set VERSION=v{{.MAJOR}}.{{.MINOR}}.{{.NEXT_PATCH}} + + version:update:minor: + desc: Increment minor version (e.g., 1.2.3 -> 1.3.0) + cmds: + - task version:set VERSION=v{{.MAJOR}}.{{.NEXT_MINOR}}.0 + + version:update:major: + desc: Increment major version (e.g., 1.2.3 -> 2.0.0) + cmds: + - task version:set VERSION=v{{.NEXT_MAJOR}}.0.0 + + version:tag-release: + desc: Create set of git tags + cmds: + - | + set -eu + if (set -o | grep -q pipefail) 2>/dev/null; then set -o pipefail; fi + + REMOTE='origin' + FULL='{{.VERSION_FULL}}' + MINOR='{{.VERSION_MINOR}}' + MAJOR='{{.VERSION_MAJOR}}' + + # Validate vX.Y.Z + if ! printf "%s" "$FULL" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then + echo "❌ ERROR: VERSION '$FULL' must match vX.Y.Z" >&2 + exit 1 + fi + + tag_sha() { git rev-parse "refs/tags/$1" 2>/dev/null || true; } + remote_tag_sha() { git ls-remote --tags "$REMOTE" "refs/tags/$1" 2>/dev/null | awk '{print $1}' || true; } + + echo "ℹ️ INFO: Tags - Full: $FULL | Minor: $MINOR | Major: $MAJOR" + + # Full tag: must NOT exist on remote; fail fast if it does + full_remote_sha="$(remote_tag_sha "$FULL")" + if [ -n "$full_remote_sha" ]; then + echo "❌ ERROR: Full tag '$FULL' already exists on remote; aborting" >&2 + exit 1 + fi + + # Create full tag locally (if missing) and push + if git rev-parse --quiet --verify "refs/tags/$FULL" >/dev/null 2>&1; then + echo "ℹ️ INFO: Full tag '$FULL' exists locally but not on remote; pushing" + else + echo "ℹ️ INFO: Creating full tag '$FULL'" + git tag --annotate "$FULL" --message "$FULL" + fi + git push "$REMOTE" "refs/tags/$FULL" + echo "✅ OK: Pushed full tag '$FULL'" + + # Minor tag: create or update + git tag --force --annotate "$MINOR" --message "$FULL" + minor_local_sha="$(tag_sha "$MINOR")" + minor_remote_sha="$(remote_tag_sha "$MINOR")" + if [ -z "$minor_remote_sha" ]; then + git push "$REMOTE" "refs/tags/$MINOR" + echo "✅ OK: Created and pushed minor tag '$MINOR' -> $minor_local_sha" + else + if [ "$minor_local_sha" != "$minor_remote_sha" ]; then + echo "⚠️ WARN: Updating remote minor tag '$MINOR' to $minor_local_sha (was $minor_remote_sha)" + git push --force "$REMOTE" "refs/tags/$MINOR" + else + echo "ℹ️ INFO: Minor tag '$MINOR' already up-to-date" + fi + fi + + # Major tag: create or update + git tag --force --annotate "$MAJOR" --message "$FULL" + major_local_sha="$(tag_sha "$MAJOR")" + major_remote_sha="$(remote_tag_sha "$MAJOR")" + if [ -z "$major_remote_sha" ]; then + git push "$REMOTE" "refs/tags/$MAJOR" + echo "✅ OK: Created and pushed major tag '$MAJOR' -> $major_local_sha" + else + if [ "$major_local_sha" != "$major_remote_sha" ]; then + echo "⚠️ WARN: Updating remote major tag '$MAJOR' to $major_local_sha (was $major_remote_sha)" + git push --force "$REMOTE" "refs/tags/$MAJOR" + else + echo "ℹ️ INFO: Major tag '$MAJOR' already up-to-date" + fi + fi diff --git a/Taskfile.variables.yml b/Taskfile.variables.yml index c91973f..b84a5ca 100644 --- a/Taskfile.variables.yml +++ b/Taskfile.variables.yml @@ -3,7 +3,6 @@ version: '3' silent: true env: - DOCKER_BUILDKIT: '1' TERM: xterm-256color vars: @@ -29,54 +28,6 @@ vars: fi PROJECT_DIR_NAME: sh: basename "$PWD" - DOCKER_IMAGE: '{{.DOCKER_IMAGE | default .PROJECT_DIR_NAME}}' - GITHUB_REPO: '{{.GITHUB_REPO | default .PROJECT_DIR_NAME}}' - DOCKER_ORG_NAME: '{{.DOCKER_ORG_NAME | default "devopsinfra"}}' - GITHUB_ORG_NAME: '{{.GITHUB_ORG_NAME | default "devops-infra"}}' - DOCKER_USERNAME: '{{.DOCKER_USERNAME | default "christophshyper"}}' - GITHUB_USERNAME: '{{.GITHUB_USERNAME | default "ChristophShyper"}}' - DOCKER_NAME: '{{.DOCKER_ORG_NAME}}/{{.DOCKER_IMAGE}}' - GITHUB_NAME: '{{.GITHUB_ORG_NAME}}/{{.GITHUB_REPO}}' - GHRC_NAME: ghcr.io/{{.GITHUB_ORG_NAME}}/{{.GITHUB_REPO}} - DEFAULT_BRANCH: master - VERSION_FROM_ACTION_YML: - sh: 'grep "image: docker://{{.DOCKER_NAME}}:" action.yml 2>/dev/null | cut -d ":" -f 4' - AUTHOR_FROM_ACTION_YML: - sh: | - grep -e "^author:" action.yml 2>/dev/null | head -1 | awk -F": " '{print $2}' - NAME_FROM_ACTION_YML: - sh: | - grep -e "^name:" action.yml 2>/dev/null | head -1 | awk -F": " '{print $2}' - DESCRIPTION_FROM_ACTION_YML: - sh: | - grep -e "^description:" action.yml 2>/dev/null | head -1 | awk -F": " '{print $2}' - LABEL_AUTHOR: '{{.LABEL_AUTHOR | default .AUTHOR_FROM_ACTION_YML}}' - LABEL_NAME: '{{.LABEL_NAME | default .NAME_FROM_ACTION_YML}}' - LABEL_DESCRIPTION: '{{.LABEL_DESCRIPTION | default .DESCRIPTION_FROM_ACTION_YML}}' - LABEL_REPO_URL: '{{ default (printf "https://github.com/%s/%s" .GITHUB_ORG_NAME .DOCKER_IMAGE) .LABEL_REPO_URL }}' - LABEL_DOCS_URL: >- - {{ default (printf "https://github.com/%s/%s/blob/%s/README.md" .GITHUB_ORG_NAME .DOCKER_IMAGE - .DEFAULT_BRANCH) .LABEL_DOCS_URL }} - LABEL_HOMEPAGE: '{{.LABEL_HOMEPAGE | default "https://shyper.pro"}}' - LABEL_VENDOR: '{{.LABEL_VENDOR | default "DevOps-Infra"}}' - LABEL_LICENSE: '{{.LABEL_LICENSE | default "MIT"}}' - CONTEXT: '{{.CONTEXT | default "."}}' - DOCKERFILE: '{{.DOCKERFILE | default "Dockerfile"}}' - PLATFORMS: '{{.PLATFORMS | default "linux/amd64,linux/arm64"}}' - BUILD_DATE: - sh: date -u +"%Y-%m-%dT%H:%M:%SZ" - LAST_RELEASE: - sh: | - curl --silent "https://api.github.com/repos/{{.GITHUB_ORG_NAME}}/{{.GITHUB_REPO}}/releases/latest" | \ - grep '"tag_name":' | \ - {{.SED}} -E 's/.*"([^"]+)".*/\1/' - VERSION_SUFFIX: - sh: | - if [ "${VERSION_SUFFIX+x}" = "x" ]; then - printf "%s" "${VERSION_SUFFIX}" - else - printf "%s" "-test" - fi VERSION_OVERRIDE: sh: echo "${VERSION_OVERRIDE:-}" VERSION: @@ -85,13 +36,11 @@ vars: if [ -n "$override" ]; then echo "$override" else - tag="$(git tag --sort=-v:refname 2>/dev/null | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1)" - if [ -n "$tag" ]; then - echo "$tag" - elif [ -n "{{.VERSION_FROM_ACTION_YML}}" ]; then - echo "{{.VERSION_FROM_ACTION_YML}}" + latest_tag="$(git tag --sort=-v:refname 2>/dev/null | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1)" + if [ -n "$latest_tag" ]; then + echo "$latest_tag" else - echo "{{.LAST_RELEASE}}" + echo "v0.0.0" fi fi VERSION_NO_V: @@ -111,10 +60,6 @@ vars: sh: echo $(( {{.MINOR}} + 1 )) NEXT_MAJOR: sh: echo $(( {{.MAJOR}} + 1 )) - MAJOR_FROM_ACTION_YML: - sh: echo "{{.VERSION_FROM_ACTION_YML}}" | awk -F\. '{print $1}' - MINOR_FROM_ACTION_YML: - sh: echo "{{.VERSION_FROM_ACTION_YML}}" | awk -F\. '{print $1"."$2}' GIT_SHA: sh: git rev-parse HEAD 2>/dev/null || echo 0000000000000000000000000000000000000000 GIT_SHORT_SHA: @@ -126,87 +71,3 @@ vars: else git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown" fi - # Labels for http://label-schema.org/rc1/#build-time-labels - # And for https://github.com/opencontainers/image-spec/blob/master/annotations.md - ANNOTATIONS: >- - --annotation index:org.label-schema.schema-version="1.0" - --annotation index:org.label-schema.build-date="{{.BUILD_DATE}}" - --annotation index:org.label-schema.name="{{.LABEL_NAME}}" - --annotation index:org.label-schema.description="{{.LABEL_DESCRIPTION}}" - --annotation index:org.label-schema.usage="{{.LABEL_DOCS_URL}}" - --annotation index:org.label-schema.url="{{.LABEL_HOMEPAGE}}" - --annotation index:org.label-schema.vcs-url="{{.LABEL_REPO_URL}}" - --annotation index:org.label-schema.vcs-ref="{{.GIT_SHA}}" - --annotation index:org.label-schema.vendor="{{.LABEL_VENDOR}}" - --annotation index:org.label-schema.version="{{.VERSION_FULL}}{{.VERSION_SUFFIX}}" - --annotation index:org.opencontainers.image.created="{{.BUILD_DATE}}" - --annotation index:org.opencontainers.image.authors="{{.LABEL_AUTHOR}}" - --annotation index:org.opencontainers.image.url="{{.LABEL_HOMEPAGE}}" - --annotation index:org.opencontainers.image.documentation="{{.LABEL_DOCS_URL}}" - --annotation index:org.opencontainers.image.source="{{.LABEL_REPO_URL}}" - --annotation index:org.opencontainers.image.version="{{.VERSION_FULL}}{{.VERSION_SUFFIX}}" - --annotation index:org.opencontainers.image.revision="{{.GIT_SHA}}" - --annotation index:org.opencontainers.image.vendor="{{.LABEL_VENDOR}}" - --annotation index:org.opencontainers.image.licenses="{{.LABEL_LICENSE}}" - --annotation index:org.opencontainers.image.title="{{.LABEL_NAME}}" - --annotation index:org.opencontainers.image.description="{{.LABEL_DESCRIPTION}}" - --annotation manifest:org.label-schema.schema-version="1.0" - --annotation manifest:org.label-schema.build-date="{{.BUILD_DATE}}" - --annotation manifest:org.label-schema.name="{{.LABEL_NAME}}" - --annotation manifest:org.label-schema.description="{{.LABEL_DESCRIPTION}}" - --annotation manifest:org.label-schema.usage="{{.LABEL_DOCS_URL}}" - --annotation manifest:org.label-schema.url="{{.LABEL_HOMEPAGE}}" - --annotation manifest:org.label-schema.vcs-url="{{.LABEL_REPO_URL}}" - --annotation manifest:org.label-schema.vcs-ref="{{.GIT_SHA}}" - --annotation manifest:org.label-schema.vendor="{{.LABEL_VENDOR}}" - --annotation manifest:org.label-schema.version="{{.VERSION_FULL}}{{.VERSION_SUFFIX}}" - --annotation manifest:org.opencontainers.image.created="{{.BUILD_DATE}}" - --annotation manifest:org.opencontainers.image.authors="{{.LABEL_AUTHOR}}" - --annotation manifest:org.opencontainers.image.url="{{.LABEL_HOMEPAGE}}" - --annotation manifest:org.opencontainers.image.documentation="{{.LABEL_DOCS_URL}}" - --annotation manifest:org.opencontainers.image.source="{{.LABEL_REPO_URL}}" - --annotation manifest:org.opencontainers.image.version="{{.VERSION_FULL}}{{.VERSION_SUFFIX}}" - --annotation manifest:org.opencontainers.image.revision="{{.GIT_SHA}}" - --annotation manifest:org.opencontainers.image.vendor="{{.LABEL_VENDOR}}" - --annotation manifest:org.opencontainers.image.licenses="{{.LABEL_LICENSE}}" - --annotation manifest:org.opencontainers.image.title="{{.LABEL_NAME}}" - --annotation manifest:org.opencontainers.image.description="{{.LABEL_DESCRIPTION}}" - LABELS: >- - --label org.label-schema.schema-version="1.0" - --label org.label-schema.build-date="{{.BUILD_DATE}}" - --label org.label-schema.name="{{.LABEL_NAME}}" - --label org.label-schema.description="{{.LABEL_DESCRIPTION}}" - --label org.label-schema.usage="{{.LABEL_DOCS_URL}}" - --label org.label-schema.url="{{.LABEL_HOMEPAGE}}" - --label org.label-schema.vcs-url="{{.LABEL_REPO_URL}}" - --label org.label-schema.vcs-ref="{{.GIT_SHA}}" - --label org.label-schema.vendor="{{.LABEL_VENDOR}}" - --label org.label-schema.version="{{.VERSION_FULL}}{{.VERSION_SUFFIX}}" - --label org.opencontainers.image.created="{{.BUILD_DATE}}" - --label org.opencontainers.image.authors="{{.LABEL_AUTHOR}}" - --label org.opencontainers.image.url="{{.LABEL_HOMEPAGE}}" - --label org.opencontainers.image.documentation="{{.LABEL_DOCS_URL}}" - --label org.opencontainers.image.source="{{.LABEL_REPO_URL}}" - --label org.opencontainers.image.version="{{.VERSION_FULL}}{{.VERSION_SUFFIX}}" - --label org.opencontainers.image.revision="{{.GIT_SHA}}" - --label org.opencontainers.image.vendor="{{.LABEL_VENDOR}}" - --label org.opencontainers.image.licenses="{{.LABEL_LICENSE}}" - --label org.opencontainers.image.title="{{.LABEL_NAME}}" - --label org.opencontainers.image.description="{{.LABEL_DESCRIPTION}}" - TAGS: >- - --tag {{.DOCKER_NAME}}:{{.VERSION_FULL}}{{.VERSION_SUFFIX}} - --tag {{.DOCKER_NAME}}:{{.VERSION_MINOR}}{{.VERSION_SUFFIX}} - --tag {{.DOCKER_NAME}}:{{.VERSION_MAJOR}}{{.VERSION_SUFFIX}} - --tag {{.DOCKER_NAME}}:latest{{.VERSION_SUFFIX}} - --tag {{.GHRC_NAME}}:{{.VERSION_FULL}}{{.VERSION_SUFFIX}} - --tag {{.GHRC_NAME}}:{{.VERSION_MINOR}}{{.VERSION_SUFFIX}} - --tag {{.GHRC_NAME}}:{{.VERSION_MAJOR}}{{.VERSION_SUFFIX}} - --tag {{.GHRC_NAME}}:latest{{.VERSION_SUFFIX}} - DOCKER_BUILD_START: - sh: | - if docker buildx version >/dev/null 2>&1; then - echo "docker buildx build --platform {{.PLATFORMS}}" - else - echo "docker build" - fi - DOCKER_BUILD_FINISH: '{{.ANNOTATIONS}} {{.LABELS}} {{.TAGS}} --file={{.DOCKERFILE}} .' diff --git a/Taskfile.yml b/Taskfile.yml index fa10a3a..b2f1774 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -7,6 +7,7 @@ dotenv: includes: variables: ./Taskfile.variables.yml + scripts: ./Taskfile.scripts.yml cicd: taskfile: ./Taskfile.cicd.yml flatten: true @@ -20,12 +21,4 @@ tasks: help: desc: Detailed help cmds: - - | - echo "Tasks:" - task --list - echo "" - echo "Environment:" - echo " DOCKER_NAME={{.DOCKER_NAME}} DOCKER_USERNAME={{.DOCKER_USERNAME}}" - echo " GHRC_NAME={{.GHRC_NAME}} GITHUB_USERNAME={{.GITHUB_USERNAME}}" - echo " LAST_RELEASE={{.LAST_RELEASE}}" VERSION={{.VERSION}} VERSION_FULL={{.VERSION_FULL}} - echo " BRANCH={{.GIT_BRANCH}} GIT_SHORT_SHA={{.GIT_SHORT_SHA}}" GIT_SHA={{.GIT_SHA}} + - task: scripts:help diff --git a/templates/actions/workflows/auto-release-create.yml b/templates/actions/workflows/auto-release-create.yml index 8bb434d..9165169 100644 --- a/templates/actions/workflows/auto-release-create.yml +++ b/templates/actions/workflows/auto-release-create.yml @@ -5,6 +5,18 @@ on: branches: - master - main + workflow_dispatch: + inputs: + release_branch: + description: Release branch to publish from (e.g. release/v1.3.0) + required: false + default: '' + type: string + release_version: + description: Explicit release version override (e.g. v1.3.0) + required: false + default: '' + type: string permissions: contents: write @@ -15,4 +27,6 @@ jobs: uses: devops-infra/.github/.github/workflows/reusable-auto-release-create.yml@v1 with: profile: actions + release-branch: ${{ inputs.release_branch }} + release-version: ${{ inputs.release_version }} secrets: inherit diff --git a/templates/dockerized/workflows/auto-release-create.yml b/templates/dockerized/workflows/auto-release-create.yml index 18cb223..0922cd8 100644 --- a/templates/dockerized/workflows/auto-release-create.yml +++ b/templates/dockerized/workflows/auto-release-create.yml @@ -5,6 +5,18 @@ on: branches: - master - main + workflow_dispatch: + inputs: + release_branch: + description: Release branch to publish from (e.g. release/v1.3.0) + required: false + default: '' + type: string + release_version: + description: Explicit release version override (e.g. v1.3.0) + required: false + default: '' + type: string permissions: contents: write @@ -15,4 +27,6 @@ jobs: uses: devops-infra/.github/.github/workflows/reusable-auto-release-create.yml@v1 with: profile: dockerized + release-branch: ${{ inputs.release_branch }} + release-version: ${{ inputs.release_version }} secrets: inherit diff --git a/templates/other/workflows/auto-release-create.yml b/templates/other/workflows/auto-release-create.yml index a9c2da4..e19a149 100644 --- a/templates/other/workflows/auto-release-create.yml +++ b/templates/other/workflows/auto-release-create.yml @@ -5,6 +5,18 @@ on: branches: - master - main + workflow_dispatch: + inputs: + release_branch: + description: Release branch to publish from (e.g. release/v1.3.0) + required: false + default: '' + type: string + release_version: + description: Explicit release version override (e.g. v1.3.0) + required: false + default: '' + type: string permissions: contents: write @@ -15,4 +27,6 @@ jobs: uses: devops-infra/.github/.github/workflows/reusable-auto-release-create.yml@v1 with: profile: other + release-branch: ${{ inputs.release_branch }} + release-version: ${{ inputs.release_version }} secrets: inherit diff --git a/templates/static/workflows/auto-release-create.yml b/templates/static/workflows/auto-release-create.yml index e4ef47e..9866e59 100644 --- a/templates/static/workflows/auto-release-create.yml +++ b/templates/static/workflows/auto-release-create.yml @@ -5,6 +5,18 @@ on: branches: - master - main + workflow_dispatch: + inputs: + release_branch: + description: Release branch to publish from (e.g. release/v1.3.0) + required: false + default: '' + type: string + release_version: + description: Explicit release version override (e.g. v1.3.0) + required: false + default: '' + type: string permissions: contents: write @@ -15,4 +27,6 @@ jobs: uses: devops-infra/.github/.github/workflows/reusable-auto-release-create.yml@v1 with: profile: static + release-branch: ${{ inputs.release_branch }} + release-version: ${{ inputs.release_version }} secrets: inherit