1+ name : Build image
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ branches : [master, minimal]
7+
8+ concurrency :
9+ group : " build-image-${{ github.ref }}"
10+ cancel-in-progress : true
11+
12+ jobs :
13+ build-image :
14+ runs-on : ubuntu-latest
15+
16+ permissions :
17+ contents : read
18+ packages : write
19+
20+ steps :
21+ - name : Checkout
22+ uses : actions/checkout@v4
23+ with :
24+ persist-credentials : false
25+
26+ - name : Install Node.js
27+ uses : actions/setup-node@v4
28+ with :
29+ node-version : 22
30+ cache : npm
31+
32+ - name : Install dependencies
33+ run : npm ci
34+
35+ - name : Build for production
36+ run : npm run build
37+
38+ - name : Choose image name
39+ id : image
40+ run : |
41+ owner=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
42+ if [ "${{ github.ref_name }}" = "minimal" ]; then
43+ echo "name=ghcr.io/${owner}/blockextensions-minimal" >> "$GITHUB_OUTPUT"
44+ else
45+ echo "name=ghcr.io/${owner}/blockextensions" >> "$GITHUB_OUTPUT"
46+ fi
47+
48+ - name : Log in to GitHub Container Registry
49+ uses : docker/login-action@v3
50+ with :
51+ registry : ghcr.io
52+ username : ${{ github.actor }}
53+ password : ${{ secrets.GITHUB_TOKEN }}
54+
55+ - name : Collect image metadata
56+ id : meta
57+ uses : docker/metadata-action@v5
58+ with :
59+ images : ${{ steps.image.outputs.name }}
60+ tags : |
61+ type=sha,format=short,prefix=sha-
62+ type=raw,value=latest
63+
64+ - name : Set up Buildx
65+ uses : docker/setup-buildx-action@v3
66+
67+ - name : Build and push image
68+ uses : docker/build-push-action@v6
69+ with :
70+ context : .
71+ file : docker/Dockerfile
72+ push : true
73+ provenance : false
74+ tags : ${{ steps.meta.outputs.tags }}
75+ labels : ${{ steps.meta.outputs.labels }}
76+ build-args : |
77+ SOURCE_URL=${{ github.server_url }}/${{ github.repository }}
78+ REVISION=${{ github.sha }}
0 commit comments