Add shared docker-tags composite action for multi-channel Docker tag resolution
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7e458f30f6
commit
dac7a1704a
70
docker-tags/action.yml
Normal file
70
docker-tags/action.yml
Normal file
@ -0,0 +1,70 @@
|
||||
# Docker Tag Resolver
|
||||
# Generates Docker image tags based on branch (dev / next-release / main)
|
||||
#
|
||||
# Tag strategy:
|
||||
# main -> latest, <calver>, <calver>-<sha>
|
||||
# next-release -> next-release, <calver>-rc, <calver>-rc-<sha>
|
||||
# anything else -> dev, dev-<sha>
|
||||
|
||||
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}"
|
||||
Loading…
Reference in New Issue
Block a user