Skip to content

Tag Latest Docker

Tag Latest Docker #11

name: Tag Latest Docker
on:
workflow_dispatch:
inputs:
version:
description: 'Version to tag as latest'
required: true
jobs:
tag-latest-matter-extension-dependencies-image:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
# Checkout repository (not strictly needed for tagging, but good practice)
- uses: actions/checkout@v4
# Login to GitHub Container Registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Set version variable for the image tag, error if not set
- name: Set version variable
run: |
VERSION="${{ github.event.inputs.version }}"
if [ -z "$VERSION" ]; then
echo "ERROR: VERSION must be set via workflow input"
exit 1
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
# Pull, tag as latest, and push the Docker image
- name: Tag and push latest Docker image
run: |
docker pull ghcr.io/siliconlabssoftware/matter_extension_dependencies:${{ env.VERSION }}
docker tag ghcr.io/siliconlabssoftware/matter_extension_dependencies:${{ env.VERSION }} ghcr.io/siliconlabssoftware/matter_extension_dependencies:latest
docker push ghcr.io/siliconlabssoftware/matter_extension_dependencies:latest