Skip to content

Commit

Permalink
Docker image: retag workflow (#3679)
Browse files Browse the repository at this point in the history
  • Loading branch information
LesnyRumcajs authored Nov 7, 2023
1 parent a623509 commit 463469d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/docker-latest-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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-latest
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 tag ghcr.io/chainsafe/forest:${{ github.event.inputs.tag }} ghcr.io/chainsafe/forest:${{ github.event.inputs.new_tag }}
- name: Push image
if: ${{ !github.event.inputs.dry_run }}
run: |
docker push ghcr.io/chainsafe/forest:${{ github.event.inputs.new_tag }}
3 changes: 1 addition & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

# This step yields the following labels
# - latest,
# - date+sha, e.g. 2023-01-19-da4692d,
# - tag (if pushed).
- name: Docker Meta
Expand All @@ -61,7 +60,7 @@ jobs:
with:
images: ghcr.io/chainsafe/forest
flavor: |
latest=auto
latest=false
tags: |
type=raw,value={{date 'YYYY-MM-DD'}}-{{sha}}
type=ref,event=tag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ Make a pull request with the following changes:
assets are automatically generated and should show up after 30 minutes to an
hour).
- Verify that the new release is available in the GitHub Container Registry. Use
`docker pull ghcr.io/chainsafe/forest:<version>` and ensure that it is present
in the [packages][6] list with the `latest` tag.
`docker pull ghcr.io/chainsafe/forest:<version>`. If it's a new stable release
(and not a backport), tag the image as `latest` with a <link to come> action.
Verify the tags in the [packages][6] list.

[1]: https://keepachangelog.com/en/1.0.0/
[2]: https://github.com/ChainSafe/forest/blob/main/Cargo.toml
Expand Down

0 comments on commit 463469d

Please sign in to comment.