Skip to content

Merge pull request #107 from alphagov/split-workspaces #20

Merge pull request #107 from alphagov/split-workspaces

Merge pull request #107 from alphagov/split-workspaces #20

name: Build and push diff generator image
on:
workflow_dispatch:
inputs:
gitRef:
description: 'Commit, tag or branch name to deploy'
required: true
type: string
push:
branches:
- main
paths:
- "diff-generator/*"
jobs:
build-and-publish-image:
name: Build and publish image
uses: alphagov/govuk-infrastructure/.github/workflows/build-and-push-multiarch-image.yml@main
with:
gitRef: ${{ inputs.gitRef || github.ref }}
dockerfilePath: diff-generator/Dockerfile
context: diff-generator
imageName: govuk-fastly-diff-generator
permissions:
id-token: write
contents: read
packages: write
tag-latest:
name: Tag built image as latest
needs: build-and-publish-image
runs-on: ubuntu-latest
permissions:
id-token: write
packages: write
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: |
IMAGE_URI=ghcr.io/${{ github.repository_owner }}/govuk/govuk-fastly-diff-generator:${{ needs.build-and-publish-image.outputs.imageTag }}
LATEST_URI=ghcr.io/${{ github.repository_owner }}/govuk/govuk-fastly-diff-generator:latest
docker pull $IMAGE_URI
docker tag $IMAGE_URI $LATEST_URI
docker push $LATEST_URI