Skip to content

Commit 8f65a63

Browse files
init
1 parent b4dfe1e commit 8f65a63

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

.github/workflows/cicd.yaml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@ defaults:
1111
working-directory: ./src/base/src/.devcontainer
1212

1313

14-
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
15-
env:
16-
REGISTRY: ghcr.io
17-
IMAGE_NAME: ${{ github.repository }}
18-
1914
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
2015
jobs:
2116
build-and-push-image:
2217
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- dockerfile: ./src/devcontainers/base/src/.devcontainer/Dockerfile
23+
registry: ghcr.io
24+
image: nhsdigital/nhs-notify-devcontainer-base
25+
2326
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
2427
permissions:
2528
contents: read
@@ -34,24 +37,23 @@ jobs:
3437
- name: Log in to the Container registry
3538
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
3639
with:
37-
registry: ${{ env.REGISTRY }}
40+
registry: ${{ matrix.registry }}
3841
username: ${{ github.actor }}
3942
password: ${{ secrets.GITHUB_TOKEN }}
4043
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
4144
- name: Extract metadata (tags, labels) for Docker
4245
id: meta
4346
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
4447
with:
45-
context: ./src/devcontainers/base/src/.devcontainer
46-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48+
images: ${{ matrix.registry }}/${{ matrix.image }}
4749
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
4850
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
4951
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
5052
- name: Build and push Docker image
5153
id: push
5254
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
5355
with:
54-
context: ./src/devcontainers/base/src/.devcontainer
56+
file: ${{ matrix.dockerfile }}
5557
push: true
5658
tags: ${{ steps.meta.outputs.tags }}
5759
labels: ${{ steps.meta.outputs.labels }}
@@ -61,7 +63,7 @@ jobs:
6163
uses: actions/attest-build-provenance@v3
6264
with:
6365
context: ./src/devcontainers/base/src/.devcontainer
64-
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
66+
subject-name: ${{ matrix.registry }}/${{ matrix.image }}
6567
subject-digest: ${{ steps.push.outputs.digest }}
6668
push-to-registry: true
6769

0 commit comments

Comments
 (0)