1
1
name : Publish Docker Image
2
- on :
2
+ on :
3
3
push :
4
- branches : [ master ]
4
+ branches : [master]
5
5
6
- concurrency :
6
+ concurrency :
7
7
group : ${{ github.ref }}-${{ github.workflow }}
8
8
cancel-in-progress : true
9
9
@@ -20,11 +20,12 @@ jobs:
20
20
- name : Set up Docker Buildx
21
21
uses : docker/setup-buildx-action@v2
22
22
23
- - name : Docker login
24
- uses : docker/login-action@v2
23
+ - name : login to ghcr.io
24
+ uses : docker/login-action@v3
25
25
with :
26
- username : ${{ secrets.DOCKER_USERNAME }}
27
- password : ${{ secrets.DOCKER_PASSWORD }}
26
+ registry : ghcr.io
27
+ username : ${{ github.actor }}
28
+ password : ${{ secrets.GITHUB_TOKEN }}
28
29
29
30
- name : Get commit SHA
30
31
id : vars
@@ -37,38 +38,15 @@ jobs:
37
38
with :
38
39
platforms : linux/amd64
39
40
context : scripts/
40
- tags : tindy2013 /subconverter:latest
41
+ tags : ghcr.io/metacubex /subconverter:latest
41
42
build-args : |
42
43
SHA=${{ steps.vars.outputs.sha_short }}
43
44
outputs : type=image,push=true
44
45
45
- - name : Replace tag without `v`
46
- if : startsWith(github.ref, 'refs/tags/')
47
- uses : actions/github-script@v6
48
- id : version
49
- with :
50
- script : |
51
- return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
52
- result-encoding : string
53
-
54
- - name : Build release and export
55
- id : build_rel
56
- if : startsWith(github.ref, 'refs/tags/')
57
- uses : docker/build-push-action@v3
58
- with :
59
- platforms : linux/amd64
60
- context : scripts/
61
- tags : tindy2013/subconverter:${{steps.version.outputs.result}}
62
- outputs : type=image,push=true
63
-
64
46
- name : Save digest
65
47
if : github.ref == 'refs/heads/master'
66
48
run : echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt
67
49
68
- - name : Save release digest
69
- if : startsWith(github.ref, 'refs/tags/')
70
- run : echo ${{ steps.build_rel.outputs.digest }} > /tmp/digest.txt
71
-
72
50
- name : Upload artifact
73
51
uses : actions/upload-artifact@v3
74
52
with :
@@ -87,11 +65,12 @@ jobs:
87
65
- name : Set up Docker Buildx
88
66
uses : docker/setup-buildx-action@v2
89
67
90
- - name : Docker login
91
- uses : docker/login-action@v2
68
+ - name : login to ghcr.io
69
+ uses : docker/login-action@v3
92
70
with :
93
- username : ${{ secrets.DOCKER_USERNAME }}
94
- password : ${{ secrets.DOCKER_PASSWORD }}
71
+ registry : ghcr.io
72
+ username : ${{ github.actor }}
73
+ password : ${{ secrets.GITHUB_TOKEN }}
95
74
96
75
- name : Get commit SHA
97
76
id : vars
@@ -104,120 +83,24 @@ jobs:
104
83
with :
105
84
platforms : linux/386
106
85
context : scripts/
107
- tags : tindy2013 /subconverter:latest
86
+ tags : ghcr.io/metacubex /subconverter:latest
108
87
build-args : |
109
88
SHA=${{ steps.vars.outputs.sha_short }}
110
89
outputs : type=image,push=true
111
90
112
- - name : Replace tag without `v`
113
- if : startsWith(github.ref, 'refs/tags/')
114
- uses : actions/github-script@v6
115
- id : version
116
- with :
117
- script : |
118
- return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
119
- result-encoding : string
120
-
121
- - name : Build release and export
122
- id : build_rel
123
- if : startsWith(github.ref, 'refs/tags/')
124
- uses : docker/build-push-action@v3
125
- with :
126
- platforms : linux/386
127
- context : scripts/
128
- tags : tindy2013/subconverter:${{steps.version.outputs.result}}
129
- outputs : type=image,push=true
130
-
131
91
- name : Save digest
132
92
if : github.ref == 'refs/heads/master'
133
93
run : echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt
134
94
135
- - name : Save release digest
136
- if : startsWith(github.ref, 'refs/tags/')
137
- run : echo ${{ steps.build_rel.outputs.digest }} > /tmp/digest.txt
138
-
139
95
- name : Upload artifact
140
96
uses : actions/upload-artifact@v3
141
97
with :
142
98
name : digest_386
143
99
path : /tmp/digest.txt
144
100
145
- armv7_build :
146
- name : Build ARMv7 Image
147
- runs-on : [self-hosted, linux, ARM64]
148
- steps :
149
- - name : Checkout base
150
- uses : actions/checkout@v3
151
- with :
152
- fetch-depth : 0
153
-
154
- - name : Set up QEMU
155
- uses : docker/setup-qemu-action@v2
156
-
157
- - name : Set up Docker Buildx
158
- uses : docker/setup-buildx-action@v2
159
-
160
- - name : Docker login
161
- uses : docker/login-action@v2
162
- with :
163
- username : ${{ secrets.DOCKER_USERNAME }}
164
- password : ${{ secrets.DOCKER_PASSWORD }}
165
-
166
- - name : Get commit SHA
167
- id : vars
168
- run : echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
169
-
170
- - name : Build and export
171
- id : build
172
- if : github.ref == 'refs/heads/master'
173
- uses : docker/build-push-action@v3
174
- with :
175
- platforms : linux/arm/v7
176
- context : scripts/
177
- tags : tindy2013/subconverter:latest
178
- build-args : |
179
- SHA=${{ steps.vars.outputs.sha_short }}
180
- THREADS=2
181
- outputs : type=image,push=true
182
-
183
- - name : Replace tag without `v`
184
- if : startsWith(github.ref, 'refs/tags/')
185
- uses : actions/github-script@v6
186
- id : version
187
- with :
188
- script : |
189
- return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
190
- result-encoding : string
191
-
192
- - name : Build release and export
193
- id : build_rel
194
- if : startsWith(github.ref, 'refs/tags/')
195
- uses : docker/build-push-action@v3
196
- with :
197
- platforms : linux/arm/v7
198
- context : scripts/
199
- tags : tindy2013/subconverter:${{steps.version.outputs.result}}
200
- build-args : |
201
- THREADS=2
202
- outputs : type=image,push=true
203
-
204
- - name : Save digest
205
- if : github.ref == 'refs/heads/master'
206
- run : echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt
207
-
208
- - name : Save release digest
209
- if : startsWith(github.ref, 'refs/tags/')
210
- run : echo ${{ steps.build_rel.outputs.digest }} > /tmp/digest.txt
211
-
212
- - name : Upload artifact
213
- uses : actions/upload-artifact@v3
214
- with :
215
- name : digest_armv7
216
- path : /tmp/digest.txt
217
-
218
101
arm64_build :
219
102
name : Build ARM64 Image
220
- runs-on : [self-hosted, linux, ARM64]
103
+ runs-on : ubuntu-latest
221
104
steps :
222
105
- name : Checkout base
223
106
uses : actions/checkout@v3
@@ -230,11 +113,12 @@ jobs:
230
113
- name : Set up Docker Buildx
231
114
uses : docker/setup-buildx-action@v2
232
115
233
- - name : Docker login
234
- uses : docker/login-action@v2
116
+ - name : login to ghcr.io
117
+ uses : docker/login-action@v3
235
118
with :
236
- username : ${{ secrets.DOCKER_USERNAME }}
237
- password : ${{ secrets.DOCKER_PASSWORD }}
119
+ registry : ghcr.io
120
+ username : ${{ github.actor }}
121
+ password : ${{ secrets.GITHUB_TOKEN }}
238
122
239
123
- name : Get commit SHA
240
124
id : vars
@@ -247,50 +131,24 @@ jobs:
247
131
with :
248
132
platforms : linux/arm64
249
133
context : scripts/
250
- tags : tindy2013 /subconverter:latest
134
+ tags : ghcr.io/metacubex /subconverter:latest
251
135
build-args : |
252
136
SHA=${{ steps.vars.outputs.sha_short }}
253
137
THREADS=2
254
138
outputs : type=image,push=true
255
139
256
- - name : Replace tag without `v`
257
- if : startsWith(github.ref, 'refs/tags/')
258
- uses : actions/github-script@v6
259
- id : version
260
- with :
261
- script : |
262
- return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
263
- result-encoding : string
264
-
265
- - name : Build release and export
266
- id : build_rel
267
- if : startsWith(github.ref, 'refs/tags/')
268
- uses : docker/build-push-action@v3
269
- with :
270
- platforms : linux/arm64
271
- context : scripts/
272
- tags : tindy2013/subconverter:${{steps.version.outputs.result}}
273
- build-args : |
274
- THREADS=2
275
- outputs : type=image,push=true
276
-
277
140
- name : Save digest
278
141
if : github.ref == 'refs/heads/master'
279
142
run : echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt
280
143
281
- - name : Save release digest
282
- if : startsWith(github.ref, 'refs/tags/')
283
- run : echo ${{ steps.build_rel.outputs.digest }} > /tmp/digest.txt
284
-
285
144
- name : Upload artifact
286
145
uses : actions/upload-artifact@v3
287
146
with :
288
147
name : digest_arm64
289
148
path : /tmp/digest.txt
290
-
291
149
build :
292
150
name : Build
293
- needs : [amd64_build, x86_build, armv7_build, arm64_build]
151
+ needs : [amd64_build, x86_build, arm64_build]
294
152
runs-on : ubuntu-latest
295
153
steps :
296
154
- name : Checkout base
@@ -315,70 +173,13 @@ jobs:
315
173
with :
316
174
path : /tmp/images/
317
175
318
- # - name: Load image
319
- # if: github.ref == 'refs/heads/master'
320
- # run: |
321
- # docker load --input /tmp/image_amd64/image_amd64.tar
322
- # docker load --input /tmp/image_386/image_386.tar
323
- # docker load --input /tmp/image_armv7/image_armv7.tar
324
- # docker load --input /tmp/image_arm64/image_arm64.tar
325
- # docker image ls -a
326
-
327
- - name : Docker login
328
- uses : docker/login-action@v2
329
- with :
330
- username : ${{ secrets.DOCKER_USERNAME }}
331
- password : ${{ secrets.DOCKER_PASSWORD }}
332
-
333
- # - name: Get commit SHA
334
- # id: vars
335
- # run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
336
-
337
- # - name: Docker buildx image and push on master branch
338
- # if: github.ref == 'refs/heads/master'
339
- # uses: docker/build-push-action@v3
340
- # with:
341
- # platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386
342
- # context: scripts/
343
- # tags: tindy2013/subconverter:latest
344
- # build-args: |
345
- # SHA=${{ steps.vars.outputs.sha_short }}
346
- # THREADS=1
347
- # outputs: |
348
- # type=image,push=true
349
-
350
- - name : Replace tag without `v`
351
- if : startsWith(github.ref, 'refs/tags/')
352
- uses : actions/github-script@v6
353
- id : version
176
+ - name : login to ghcr.io
177
+ uses : docker/login-action@v3
354
178
with :
355
- script : |
356
- return context.payload.ref.replace(/\/?refs\/tags\/v/, '')
357
- result-encoding : string
358
-
359
- # - name: Load release image
360
- # if: startsWith(github.ref, 'refs/tags/')
361
- # run: |
362
- # docker load --input /tmp/image_amd64/image_amd64_release.tar
363
- # docker load --input /tmp/image_386/image_386_release.tar
364
- # docker load --input /tmp/image_armv7/image_armv7_release.tar
365
- # docker load --input /tmp/image_arm64/image_arm64_release.tar
366
- # docker image ls -a
367
-
368
- # - name: Docker buildx image and push on release
369
- # if: startsWith(github.ref, 'refs/tags/')
370
- # uses: docker/build-push-action@v3
371
- # with:
372
- # platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386
373
- # context: scripts/
374
- # tags: tindy2013/subconverter:${{steps.version.outputs.result}}
375
- # build-args: THREADS=1
376
- # outputs: type=image,push=true
179
+ registry : ghcr.io
180
+ username : ${{ github.actor }}
181
+ password : ${{ secrets.GITHUB_TOKEN }}
377
182
378
183
- name : Merge and push manifest on master branch
379
184
if : github.ref == 'refs/heads/master'
380
185
run : python scripts/merge_manifest.py
381
-
382
- - name : Merge and push manifest on release
383
- if : startsWith(github.ref, 'refs/tags/')
384
- run : python scripts/merge_manifest.py ${{steps.version.outputs.result}}
0 commit comments