Skip to content

Commit 03faa7c

Browse files
committed
Testing updated github docker template
1 parent bc02f76 commit 03faa7c

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,21 @@ jobs:
3333
# with sigstore/fulcio when running outside of PRs.
3434
id-token: write
3535

36+
strategy:
37+
matrix:
38+
include:
39+
- arch: amd64
40+
platform: linux/amd64
41+
3642
steps:
3743
- name: Checkout repository
3844
uses: actions/checkout@v4
3945

40-
# Install the cosign tool except on PR
41-
# https://github.com/sigstore/cosign-installer
46+
- name: Read package version
47+
id: get_version
48+
run: |
49+
echo "version=$(node -p \"require('./package.json').version\")" >> $GITHUB_OUTPUT
50+
4251
- name: Install cosign
4352
if: github.event_name != 'pull_request'
4453
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
@@ -71,14 +80,15 @@ jobs:
7180

7281
# Build and push Docker image with Buildx (don't push on PR)
7382
# https://github.com/docker/build-push-action
74-
- name: Build and push Docker image
83+
- name: Build and push Docker image (per-arch)
7584
id: build-and-push
7685
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
7786
with:
7887
context: .
7988
push: ${{ github.event_name != 'pull_request' }}
80-
tags: ${{ steps.meta.outputs.tags }}
81-
labels: ${{ steps.meta.outputs.labels }}
89+
platforms: ${{ matrix.platform }}
90+
tags: |
91+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get_version.outputs.version }}-${{ matrix.arch }}
8292
cache-from: type=gha
8393
cache-to: type=gha,mode=max
8494

@@ -90,9 +100,7 @@ jobs:
90100
- name: Sign the published Docker image
91101
if: ${{ github.event_name != 'pull_request' }}
92102
env:
93-
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
94-
TAGS: ${{ steps.meta.outputs.tags }}
103+
TAG: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get_version.outputs.version }}-${{ matrix.arch }}
95104
DIGEST: ${{ steps.build-and-push.outputs.digest }}
96-
# This step uses the identity token to provision an ephemeral certificate
97-
# against the sigstore community Fulcio instance.
98-
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
105+
run: |
106+
cosign sign --yes ${TAG}@${DIGEST}

0 commit comments

Comments
 (0)