Workflow file for this run
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
name: Docker Tag Latest Release | |
on: | |
release: | |
types: [ released ] | |
env: | |
TAG: ${{ github.event.release.tag_name }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log into Github Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clone latest repository | |
uses: actions/checkout@v2 | |
- name: Tag latest release in Github Container Registry | |
env: | |
UNSTABLE_IMAGE_ID: ghcr.io/${{ github.repository }}-unstable | |
PROD_IMAGE_ID: ghcr.io/${{ github.repository }} | |
run: | | |
docker pull $UNSTABLE_IMAGE_ID:${{ github.sha }} | |
docker tag $UNSTABLE_IMAGE_ID:${{ github.sha }} $PROD_IMAGE_ID:${{ env.TAG }} | |
docker tag $UNSTABLE_IMAGE_ID:${{ github.sha }} $PROD_IMAGE_ID:latest | |
docker push $PROD_IMAGE_ID:${{ env.TAG }} | |
docker push $PROD_IMAGE_ID:latest |