Skip to content

Commit b767cbd

Browse files
author
Matt Pryor
committed
Add build action for stackhpc-release
1 parent 1d3dc41 commit b767cbd

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Artifacts
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
container-image:
13+
name: Container image
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
variant:
19+
- alpine
20+
- distroless
21+
22+
permissions:
23+
contents: read
24+
packages: write
25+
id-token: write
26+
security-events: write
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
31+
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
34+
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@ecf95283f03858871ff00b787d79c419715afc34 # v2.7.0
37+
38+
- name: Gather build metadata
39+
id: meta
40+
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0
41+
with:
42+
images: |
43+
ghcr.io/${{ github.repository }}
44+
flavor: |
45+
latest = false
46+
tags: |
47+
type=ref,event=branch,enable=${{ matrix.variant == 'alpine' }}
48+
type=ref,event=pr,prefix=pr-,enable=${{ matrix.variant == 'alpine' }}
49+
type=semver,pattern={{raw}},enable=${{ matrix.variant == 'alpine' }}
50+
type=raw,value=latest,enable=${{ github.ref_name == github.event.repository.default_branch && matrix.variant == 'alpine' }}
51+
type=ref,event=branch,suffix=-${{ matrix.variant }}
52+
type=ref,event=pr,prefix=pr-,suffix=-${{ matrix.variant }}
53+
type=semver,pattern={{raw}},suffix=-${{ matrix.variant }}
54+
type=raw,value=latest,enable={{is_default_branch}},suffix=-${{ matrix.variant }}
55+
labels: |
56+
org.opencontainers.image.documentation=https://dexidp.io/docs/
57+
58+
- name: Login to GitHub Container Registry
59+
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
60+
with:
61+
registry: ghcr.io
62+
username: ${{ github.actor }}
63+
password: ${{ github.token }}
64+
65+
- name: Build and push image
66+
id: build
67+
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
68+
with:
69+
context: .
70+
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le
71+
tags: ${{ steps.meta.outputs.tags }}
72+
build-args: |
73+
BASE_IMAGE=${{ matrix.variant }}
74+
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
75+
COMMIT_HASH=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
76+
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
77+
labels: ${{ steps.meta.outputs.labels }}
78+
cache-from: type=gha
79+
cache-to: type=gha,mode=max
80+
push: true

0 commit comments

Comments
 (0)