1
- name : Build and publish cfssl docker image
1
+ name : cfssl docker
2
2
3
3
on :
4
+ workflow_dispatch :
4
5
push :
6
+ branches :
7
+ - " master"
5
8
tags :
6
- - ' v*.*.*'
7
-
9
+ - " v*"
8
10
jobs :
9
11
build-and-push-image :
10
12
runs-on : ubuntu-latest
11
13
permissions :
12
14
contents : read
13
15
packages : write
16
+ strategy :
17
+ matrix :
18
+ include :
19
+ # github container registry
20
+ - registry : " ghcr.io"
21
+ username : ${{ github.actor }}
22
+ password_secret : GITHUB_TOKEN
23
+ image : ghcr.io/cloudflare/cfssl
24
+ # docker test publish, todo: switch to service account
25
+ - registry : " "
26
+ username : nicky
27
+ password_secret : DOCKER_REGISTRY_TOKEN_NICKY
28
+ image : cfssl/cfssl
14
29
steps :
15
30
- name : Checkout repository
16
31
uses : actions/checkout@v3
17
32
with :
18
33
fetch-depth : 0
19
34
20
- - name : Get tag
21
- id : cfssl
22
- run : echo "::set-output name=tag::$(git describe --tags HEAD)"
23
-
24
35
- name : Set up QEMU
25
36
uses : docker/setup-qemu-action@v2
26
37
@@ -30,13 +41,19 @@ jobs:
30
41
- name : Log in to the Docker hub
31
42
uses : docker/login-action@v2
32
43
with :
33
- username : ${{ secrets.DOCKERHUB_USERNAME }}
34
- password : ${{ secrets.DOCKERHUB_TOKEN }}
35
-
44
+ registry : ${{ matrix.registry }}
45
+ username : ${{ matrix.username }}
46
+ password : ${{ secrets[matrix.password_secret] }}
47
+ - name : Extract metadata (tags, labels) for Docker
48
+ id : meta
49
+ uses : docker/metadata-action@v4
50
+ with :
51
+ images : ${{ matrix.image }}
36
52
- name : Build and push
37
53
uses : docker/build-push-action@v3
38
54
with :
39
55
context : .
40
56
platforms : linux/amd64,linux/arm64,linux/s390x
41
57
push : true
42
- tags : cfssl:${{ steps.cfssl.outputs.tag }}
58
+ tags : ${{ steps.meta.outputs.tags }}
59
+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments