Skip to content

Commit 6d561a0

Browse files
committed
Updating workflow to publish to GitHub Container Registry
Using guide from https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images
1 parent 1d629d7 commit 6d561a0

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/main.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,43 @@ jobs:
5858
- run: npm run publish-all
5959
env:
6060
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
61+
62+
publish-github-container-registry:
63+
runs-on: ubuntu-latest
64+
if: github.event_name == 'release'
65+
environment: release
66+
needs: build
67+
permissions:
68+
contents: write
69+
id-token: write
70+
steps:
71+
- uses: actions/checkout@v4
72+
73+
- name: Log in to the Container registry
74+
uses: docker/login-action@v3
75+
with:
76+
registry: ghcr.io
77+
username: ${{ github.actor }}
78+
password: ${{ secrets.GITHUB_TOKEN }}
79+
80+
- name: Extract metadata (tags, labels) for Docker
81+
id: meta
82+
uses: docker/metadata-action@v5
83+
with:
84+
images: ghcr.io/${{ github.repository }}
85+
86+
- name: Build and push Docker image
87+
id: push
88+
uses: docker/build-push-action@v6
89+
with:
90+
context: .
91+
push: true
92+
tags: ${{ steps.meta.outputs.tags }}
93+
labels: ${{ steps.meta.outputs.labels }}
94+
95+
- name: Generate artifact attestation
96+
uses: actions/attest-build-provenance@v2
97+
with:
98+
subject-name: ghcr.io/${{ github.repository }}
99+
subject-digest: ${{ steps.push.outputs.digest }}
100+
push-to-registry: true

0 commit comments

Comments
 (0)