Docker Latest tag #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Re-tag the given image and push it to the ghcr.io | |
# Preserves the old tag. | |
name: Docker Latest tag | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag of the base image to use' | |
required: true | |
type: string | |
new_tag: | |
description: 'New tag to use' | |
default: 'latest' | |
required: true | |
type: string | |
dry_run: | |
description: "Don't push the tag to GHCR" | |
required: true | |
type: boolean | |
default: false | |
jobs: | |
tag-docker-image: | |
name: Retag image and push to GHCR | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Login to Github Packages | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Re-tag image | |
run: | | |
docker pull ghcr.io/chainsafe/forest:${{ github.event.inputs.tag }} | |
docker tag ghcr.io/chainsafe/forest:${{ github.event.inputs.tag }} ghcr.io/chainsafe/forest:${{ github.event.inputs.new_tag }} | |
docker pull ghcr.io/chainsafe/forest:${{ github.event.inputs.tag }}-fat | |
docker tag ghcr.io/chainsafe/forest:${{ github.event.inputs.tag }}-fat ghcr.io/chainsafe/forest:${{ github.event.inputs.new_tag }}-fat | |
- name: Push image | |
if: ${{ !fromJSON(github.event.inputs.dry_run) }} | |
run: | | |
docker push ghcr.io/chainsafe/forest:${{ github.event.inputs.new_tag }} | |
docker push ghcr.io/chainsafe/forest:${{ github.event.inputs.new_tag }}-fat |