-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (45 loc) · 1.39 KB
/
build_diff_gen_image.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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