9
9
type : string
10
10
generic_tag :
11
11
required : true
12
- type : string
12
+ type : string
13
13
14
14
jobs :
15
- deploy-ghcr :
16
- permissions :
17
- packages : write
18
- uses : ./.github/workflows/publish_ghcr.yml
19
- secrets : inherit
20
- with :
21
- version : ${{ inputs.version }}
22
- generic_tag : ${{ inputs.generic_tag }}
15
+ deploy :
16
+ continue-on-error : true
17
+ strategy :
18
+ fail-fast : false
19
+ matrix :
20
+ registry : ['docker.io', 'ghcr.io', 'ecr']
21
+
22
+ runs-on : ubuntu-latest
23
+ steps :
24
+
25
+ - name : Download docker image
26
+ uses : actions/download-artifact@v4
27
+ with :
28
+ name : image
29
+ path : /tmp
30
+
31
+ # setup containerd to preserve provenance attestations :https://docs.docker.com/build/attestations/#creating-attestations
32
+ - name : Setup docker with containerd
33
+ uses : crazy-max/ghaction-setup-docker@v3
34
+ with :
35
+ daemon-config : |
36
+ {
37
+ "features": {
38
+ "containerd-snapshotter": true
39
+ }
40
+ }
41
+
42
+ - name : Load docker image into daemon
43
+ run : |
44
+ docker load --input /tmp/image.tar
23
45
24
- deploy-dockerhub :
25
- uses : ./.github/workflows/publish_dockerhub.yml
26
- secrets : inherit
27
- with :
28
- version : ${{ inputs.version }}
29
- generic_tag : ${{ inputs.generic_tag }}
46
+ - name : Login to docker.io
47
+ if : matrix.registry == 'docker.io'
48
+ uses : docker/login-action@v3
49
+ with :
50
+ registry : ${{ matrix.registry }}
51
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
52
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
30
53
31
- deploy-ecr :
32
- uses : ./.github/workflows/publish_ecr.yml
33
- permissions :
34
- contents : read # To read secrets
35
- id-token : write # This is required for requesting the JWT
36
- secrets : inherit
37
- with :
38
- version : ${{ inputs.version }}
39
- generic_tag : ${{ inputs.generic_tag }}
54
+ - name : Login to ghcr.io
55
+ if : matrix.registry == 'ghcr.io'
56
+ uses : docker/login-action@v3
57
+ with :
58
+ registry : ${{ matrix.registry }}
59
+ username : ${{ github.actor }}
60
+ password : ${{ secrets.GITHUB_TOKEN }}
61
+
62
+ - name : Configure AWS credentials
63
+ if : matrix.registry == 'ecr'
64
+ uses : aws-actions/configure-aws-credentials@v4
65
+ with :
66
+ aws-region : us-east-1 # This region only for public ECR
67
+ role-to-assume : ${{ secrets.AWS_ROLE }}
68
+
69
+ - name : Login to public ECR
70
+ if : matrix.registry == 'ecr'
71
+ id : login-ecr-public
72
+ uses : aws-actions/amazon-ecr-login@v2
73
+ with :
74
+ registry-type : public
75
+
76
+ - name : define env vars
77
+ run : |
78
+ if [ ${{matrix.registry }} == 'docker.io' ]; then
79
+ echo "REGISTRY=${{ matrix.registry }}" >> $GITHUB_ENV
80
+ echo "REPOSITORY=${{ github.repository }}" >> $GITHUB_ENV
81
+ elif [ ${{ matrix.registry }} == 'ghcr.io' ]; then
82
+ echo "REGISTRY=${{ matrix.registry }}" >> $GITHUB_ENV
83
+ echo "REPOSITORY=${{ github.repository }}" >> $GITHUB_ENV
84
+ elif [ ${{ matrix.registry }} == 'ecr' ]; then
85
+ echo "REGISTRY=${{ steps.login-ecr-public.outputs.registry }}" >> $GITHUB_ENV
86
+ echo "REPOSITORY=${{ github.repository }}" >> $GITHUB_ENV
87
+ else
88
+ echo "REGISTRY=" >> $GITHUB_ENV
89
+ echo "REPOSITORY=notworking" >> $GITHUB_ENV
90
+ fi
91
+
92
+ - name : Push images to ${{ matrix.registry }}
93
+ run : |
94
+ docker tag kafka-ui:temp ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ inputs.generic_tag }}
95
+ docker tag kafka-ui:temp ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ inputs.version }}
96
+ docker push ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ inputs.generic_tag }}
97
+ docker push ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ inputs.version }}
0 commit comments