From dac7a1704af136d325333fc50f92d8d82a56704e Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Wed, 4 Mar 2026 21:07:21 -0600 Subject: [PATCH] Add shared docker-tags composite action for multi-channel Docker tag resolution Co-Authored-By: Claude Opus 4.6 --- docker-tags/action.yml | 70 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 docker-tags/action.yml diff --git a/docker-tags/action.yml b/docker-tags/action.yml new file mode 100644 index 0000000..d7ffd72 --- /dev/null +++ b/docker-tags/action.yml @@ -0,0 +1,70 @@ +# Docker Tag Resolver +# Generates Docker image tags based on branch (dev / next-release / main) +# +# Tag strategy: +# main -> latest, , - +# next-release -> next-release, -rc, -rc- +# anything else -> dev, dev- + +name: Docker Tags +description: Resolve Docker image tags based on branch and CalVer version + +inputs: + image: + description: Docker image name (e.g., user/repo) + required: true + version: + description: CalVer version from the calver action + required: true + sha_short: + description: Short commit SHA (7 chars) + required: true + +outputs: + tags: + description: Comma-separated list of full image tags + value: ${{ steps.resolve.outputs.tags }} + channel: + description: Release channel (stable, rc, dev) + value: ${{ steps.resolve.outputs.channel }} + primary_tag: + description: The primary human-readable tag (latest, next-release, or dev) + value: ${{ steps.resolve.outputs.primary_tag }} + +runs: + using: composite + steps: + - name: Resolve Docker tags + id: resolve + shell: bash + run: | + IMAGE="${{ inputs.image }}" + VERSION="${{ inputs.version }}" + SHA="${{ inputs.sha_short }}" + BRANCH="${GITHUB_REF_NAME}" + + case "${BRANCH}" in + main) + TAGS="${IMAGE}:latest,${IMAGE}:${VERSION},${IMAGE}:${VERSION}-${SHA}" + CHANNEL="stable" + PRIMARY="latest" + ;; + next-release) + TAGS="${IMAGE}:next-release,${IMAGE}:${VERSION}-rc,${IMAGE}:${VERSION}-rc-${SHA}" + CHANNEL="rc" + PRIMARY="next-release" + ;; + *) + TAGS="${IMAGE}:dev,${IMAGE}:dev-${SHA}" + CHANNEL="dev" + PRIMARY="dev" + ;; + esac + + echo "tags=${TAGS}" >> $GITHUB_OUTPUT + echo "channel=${CHANNEL}" >> $GITHUB_OUTPUT + echo "primary_tag=${PRIMARY}" >> $GITHUB_OUTPUT + + echo "Branch: ${BRANCH}" + echo "Channel: ${CHANNEL}" + echo "Tags: ${TAGS}"