Skip to content

Push Release Tags

Push Release Tags #4

Workflow file for this run

name: Tag Image
on:
workflow_call:
workflow_dispatch:
jobs:
tag:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Output short SHA
run: echo "GITHUB_SHORT_SHA=${GITHUB_SHA::7}" >> "$GITHUB_ENV"
- name: Output Docker repo to be pulled from
run: echo "DOCKER_REPO=ghcr.io/${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]' >> "$GITHUB_ENV"
- name: Output Docker image to be pulled
run: echo "DOCKER_IMAGE=${DOCKER_REPO}:sha-${GITHUB_SHORT_SHA}" >> "$GITHUB_ENV"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine long-lived Docker image tags
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ github.env.DOCKER_IMAGE }}
tags: |
type=sha
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Pull the image to be retagged
run: docker pull ghcr.io/${DOCKER_IMAGE}