@@ -3,12 +3,24 @@ name: Create Release & And push Docker image
3
3
env :
4
4
DOCKER_IMAGE : wyrihaximusnet/kubernetes-redis-db-assignment-operator
5
5
DOCKER_BUILDKIT : 1
6
+ DOCKER_IMAGE_REGISTRIES_SECRET_MAPPING : ' {"ghcr.io":"GHCR_TOKEN","docker.io":"HUB_PASSCODE"}'
6
7
MILESTONE : ${{ github.event.milestone.title }}
7
8
on :
8
9
milestone :
9
10
types :
10
11
- closed
11
12
jobs :
13
+ registry-matrix :
14
+ name : Extract registries from registry secret mapping
15
+ runs-on : ubuntu-latest
16
+ outputs :
17
+ registry : ${{ steps.registry-matrix.outputs.registry }}
18
+ steps :
19
+ - uses : actions/checkout@v1
20
+ - id : registry-matrix
21
+ name : Extract registries from registry secret mapping
22
+ run : |
23
+ echo "::set-output name=registry::$(printenv DOCKER_IMAGE_REGISTRIES_SECRET_MAPPING | jq -c 'keys')"
12
24
generate-changelog :
13
25
name : Generate Changelog
14
26
runs-on : ubuntu-latest
@@ -58,15 +70,24 @@ jobs:
58
70
draft : false
59
71
prerelease : false
60
72
tag :
73
+ needs :
74
+ - registry-matrix
61
75
runs-on : ' ubuntu-latest'
76
+ strategy :
77
+ fail-fast : false
78
+ matrix :
79
+ registry : ${{ fromJson(needs.registry-matrix.outputs.registry) }}
62
80
steps :
63
81
- uses : actions/checkout@v2
64
- - run : docker build . -t "${DOCKER_IMAGE}:${{ env.MILESTONE }}"
82
+ - run : docker build . -t "${{ matrix.registry }}/${ DOCKER_IMAGE}:${{ env.MILESTONE }}"
65
83
- name : Login to Docker Hub
66
84
run : |
67
- echo "${{ secrets.HUB_PASSCODE }}" | \
68
- docker login \
69
- --username "${{ secrets.HUB_USERNAME }}" \
85
+ echo "${{ env.DOCKER_PASSWORD }}" | \
86
+ docker login ${{ matrix.registry }} \
87
+ --username "${{ env.DOCKER_USER }}" \
70
88
--password-stdin
89
+ env :
90
+ DOCKER_USER : ${{ secrets.HUB_USERNAME }}
91
+ DOCKER_PASSWORD : ${{ secrets[fromJson(env.DOCKER_IMAGE_REGISTRIES_SECRET_MAPPING)[matrix.registry]] }}
71
92
- name : Push release
72
- run : docker push "${DOCKER_IMAGE}:${{ env.MILESTONE }}"
93
+ run : docker push "${{ matrix.registry }}/${ DOCKER_IMAGE}:${{ env.MILESTONE }}"
0 commit comments