@@ -2,19 +2,20 @@ name: Main
2
2
on :
3
3
push :
4
4
branches :
5
- - ' develop'
6
- - ' feature/update**'
7
- - ' feature/server_esm**'
5
+ - " develop"
6
+ - " feature/update**"
7
+ - " feature/server_esm**"
8
8
paths-ignore :
9
- - ' docs/**'
10
- - ' bin/**'
9
+ - " docs/**"
10
+ - " bin/**"
11
11
12
12
concurrency :
13
13
group : ${{ github.workflow }}-${{ github.ref }}
14
14
cancel-in-progress : true
15
15
16
16
env :
17
- REGISTRY : ghcr.io
17
+ GHCR_REGISTRY : ghcr.io
18
+ DOCKERHUB_REGISTRY : docker.io
18
19
IMAGE_NAME : ${{ github.repository }}
19
20
20
21
jobs :
@@ -140,7 +141,7 @@ jobs:
140
141
name : TriliumNext Notes for Windows (Setup)
141
142
path : out/make/squirrel.windows/x64/*.exe
142
143
build_docker :
143
- name : Build Docker image
144
+ name : Build Docker images
144
145
runs-on : ubuntu-latest
145
146
permissions :
146
147
contents : read
@@ -149,40 +150,62 @@ jobs:
149
150
id-token : write
150
151
steps :
151
152
- uses : actions/checkout@v4
152
- - name : Log in to the Container registry
153
- uses : docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
153
+ - name : Extract metadata (tags, labels) for container GHCR image
154
+ id : ghcr-meta
155
+ uses : docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
154
156
with :
155
- registry : ${{ env.REGISTRY }}
156
- username : ${{ github.actor }}
157
- password : ${{ secrets.GITHUB_TOKEN }}
158
- - name : Extract metadata (tags, labels) for Docker
159
- id : meta
157
+ images : ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}
158
+ - name : Extract metadata (tags, labels) for container DockerHub image
159
+ id : dh-meta
160
160
uses : docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
161
161
with :
162
- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
162
+ images : ${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}
163
163
- name : Set up node & dependencies
164
164
uses : actions/setup-node@v4
165
165
with :
166
166
node-version : 20
167
167
cache : " npm"
168
- - run : npm ci
168
+ - run : npm ci
169
169
- name : Run the TypeScript build
170
170
run : npx tsc
171
171
- name : Create server-package.json
172
172
run : cat package.json | grep -v electron > server-package.json
173
+ - name : Log in to the GHCR container registry
174
+ uses : docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
175
+ with :
176
+ registry : ${{ env.GHCR_REGISTRY }}
177
+ username : ${{ github.actor }}
178
+ password : ${{ secrets.GITHUB_TOKEN }}
173
179
- uses : docker/setup-buildx-action@v3
174
- - uses : docker/build-push-action@v6
180
+ - name : Build and push container image to GHCR
181
+ uses : docker/build-push-action@v6
175
182
id : push
176
183
with :
177
184
context : .
178
185
push : true
179
- tags : ${{ steps.meta.outputs.tags }}
180
- labels : ${{ steps.meta.outputs.labels }}
186
+ tags : ${{ steps.ghcr- meta.outputs.tags }}
187
+ labels : ${{ steps.ghcr- meta.outputs.labels }}
181
188
cache-from : type=gha
182
189
cache-to : type=gha,mode=max
183
- - name : Generate artifact attestation
190
+ - name : Generate and push artifact attestation to GHCR
184
191
uses : actions/attest-build-provenance@v1
185
192
with :
186
- subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
193
+ subject-name : ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME}}
187
194
subject-digest : ${{ steps.push.outputs.digest }}
188
- push-to-registry : true
195
+ push-to-registry : true
196
+ - name : Log in to the GHCR container registry
197
+ uses : docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
198
+ with :
199
+ registry : ${{ env.GHCR_REGISTRY }}
200
+ username : ${{ github.actor }}
201
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
202
+ - name : Build and push image to DockerHub
203
+ uses : docker/build-push-action@v6
204
+ id : push
205
+ with :
206
+ context : .
207
+ push : true
208
+ tags : ${{ steps.dh-meta.outputs.tags }}
209
+ labels : ${{ steps.dh-meta.outputs.labels }}
210
+ cache-from : type=gha
211
+ cache-to : type=gha,mode=max
0 commit comments