1+ name : Build Docker images
2+
3+ on :
4+ workflow_dispatch :
5+ schedule :
6+ # run every sunday at midnight
7+ - cron : " 0 0 * * 0"
8+ push :
9+ branches :
10+ - main
11+ pull_request :
12+ branches :
13+ - main
14+
15+ jobs :
16+
17+ generate-jobs :
18+ name : Generate jobs
19+ runs-on : ubuntu-latest
20+ outputs :
21+ biome-versions : ${{ steps.matrix.outputs.BIOME_VERSIONS }}
22+ steps :
23+ - name : Checkout
24+ uses : actions/checkout@v4
25+ - name : Setup Bun
26+ uses : oven-sh/setup-bun@v1
27+ - name : Install dependencies
28+ run : bun install
29+ - name : Generate matrix
30+ id : matrix
31+ run : |
32+ BIOME_VERSIONS=$(bun run ./scripts/generate-versions.ts)
33+ echo "BIOME_VERSIONS=$BIOME_VERSIONS" >> $GITHUB_OUTPUT
34+
35+ build-images-arm64 :
36+ name : ${{ matrix.versions.patch }} (arm64)
37+ needs : generate-jobs
38+ concurrency : build-images-${{ matrix.versions.patch }}-arm64
39+ permissions :
40+ packages : write
41+ runs-on : ubuntu-22.04-arm
42+ strategy :
43+ matrix :
44+ versions : ${{ fromJson(needs.generate-jobs.outputs.biome-versions) }}
45+ steps :
46+ - name : Checkout
47+ uses : actions/checkout@v4
48+ - name : Set up Docker Buildx
49+ uses : docker/setup-buildx-action@v3
50+ - name : Log in to the Container registry
51+ uses : docker/login-action@v3
52+ with :
53+ registry : ghcr.io
54+ username : ${{ github.actor }}
55+ password : ${{ secrets.GITHUB_TOKEN }}
56+ - name : Build and push
57+ uses : docker/build-push-action@v6
58+ with :
59+ push : ${{ github.event_name != 'pull_request' }}
60+ provenance : false
61+ platforms : linux/arm64
62+ tags : ghcr.io/biomejs/biome:${{ matrix.versions.patch }}-arm64
63+ file : Dockerfile
64+ cache-from : type=gha,scope=${{ matrix.versions.patch}}-arm64
65+ cache-to : type=gha,mode=max,scope=${{ matrix.versions.patch}}-arm64
66+ build-args : |
67+ BIOME_VERSION=${{ matrix.versions.patch }}
68+
69+ build-images-amd64 :
70+ name : ${{ matrix.versions.patch }} (amd64)
71+ needs : generate-jobs
72+ concurrency : build-images-${{ matrix.versions.patch }}-amd64
73+ permissions :
74+ packages : write
75+ runs-on : ubuntu-22.04
76+ strategy :
77+ matrix :
78+ versions : ${{ fromJson(needs.generate-jobs.outputs.biome-versions) }}
79+ steps :
80+ - name : Checkout
81+ uses : actions/checkout@v4
82+ - name : Set up Docker Buildx
83+ uses : docker/setup-buildx-action@v3
84+ - name : Log in to the Container registry
85+ uses : docker/login-action@v3
86+ with :
87+ registry : ghcr.io
88+ username : ${{ github.actor }}
89+ password : ${{ secrets.GITHUB_TOKEN }}
90+ - name : Build and push
91+ uses : docker/build-push-action@v6
92+ with :
93+ push : ${{ github.event_name != 'pull_request' }}
94+ provenance : false
95+ platforms : linux/amd64
96+ tags : ghcr.io/biomejs/biome:${{ matrix.versions.patch }}-amd64
97+ file : Dockerfile
98+ cache-from : type=gha,scope=${{ matrix.versions.patch}}-amd64
99+ cache-to : type=gha,mode=max,scope=${{ matrix.versions.patch}}-amd64
100+ build-args : |
101+ BIOME_VERSION=${{ matrix.versions.patch }}
102+
103+ stitch-images :
104+ name : Stitch images (${{ matrix.versions.patch }})
105+ needs : [generate-jobs, build-images-arm64, build-images-amd64]
106+ runs-on : ubuntu-latest
107+ permissions :
108+ packages : write
109+ if : ${{ github.event_name != 'pull_request' }}
110+ strategy :
111+ matrix :
112+ versions : ${{ fromJson(needs.generate-jobs.outputs.biome-versions) }}
113+ steps :
114+ - name : Checkout
115+ uses : actions/checkout@v4
116+ - name : Set up Docker Buildx
117+ uses : docker/setup-buildx-action@v3
118+ - name : Log in to the Container registry
119+ uses : docker/login-action@v3
120+ with :
121+ registry : ghcr.io
122+ username : ${{ github.actor }}
123+ password : ${{ secrets.GITHUB_TOKEN }}
124+
125+ - name : Create major version (${{ matrix.versions.major }}) manifest
126+ if : ${{ matrix.versions.createMajor }}
127+ run : |
128+ docker manifest create ghcr.io/biomejs/biome:${{ matrix.versions.major }} \
129+ ghcr.io/biomejs/biome:${{ matrix.versions.patch }}-arm64 \
130+ ghcr.io/biomejs/biome:${{ matrix.versions.patch }}-amd64
131+ docker manifest push ghcr.io/biomejs/biome:${{ matrix.versions.major }}
132+
133+ - name : Create minor version (${{ matrix.versions.minor }}) manifest
134+ if : ${{ matrix.versions.createMinor }}
135+ run : |
136+ docker manifest create ghcr.io/biomejs/biome:${{ matrix.versions.minor }} \
137+ ghcr.io/biomejs/biome:${{ matrix.versions.patch }}-arm64 \
138+ ghcr.io/biomejs/biome:${{ matrix.versions.patch }}-amd64
139+ docker manifest push ghcr.io/biomejs/biome:${{ matrix.versions.minor }}
140+
141+ - name : Create patch version (${{ matrix.versions.patch }}) manifest
142+ run : |
143+ docker manifest create ghcr.io/biomejs/biome:${{ matrix.versions.patch }} \
144+ ghcr.io/biomejs/biome:${{ matrix.versions.patch }}-arm64 \
145+ ghcr.io/biomejs/biome:${{ matrix.versions.patch }}-amd64
146+ docker manifest push ghcr.io/biomejs/biome:${{ matrix.versions.patch }}
147+
148+ - name : Create latest (${{ matrix.versions.patch }}) manifest
149+ if : ${{ matrix.versions.patch == fromJson(needs.generate-jobs.outputs.biome-versions)[0].patch }}
150+ run : |
151+ docker manifest create ghcr.io/biomejs/biome:latest \
152+ ghcr.io/biomejs/biome:${{ matrix.versions.patch }}-arm64 \
153+ ghcr.io/biomejs/biome:${{ matrix.versions.patch }}-amd64
154+ docker manifest push ghcr.io/biomejs/biome:latest
0 commit comments