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