-
Notifications
You must be signed in to change notification settings - Fork 6
229 lines (221 loc) · 7.83 KB
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
name: Create and publish a Docker image
on:
push:
tags:
- '*'
branches: [ develop ]
env:
BRANCH_BUILD_TAGS: "latest,develop"
jobs:
parse-docker-build-env:
name: 'Parse Docker Build Environment'
runs-on: ubuntu-latest
outputs:
buildTags: ${{ steps.detect-push-event.outputs.buildTags }}
steps:
- name: Check if push is a tag or branch
id: detect-push-event
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "This is a tag push (${GITHUB_REF#refs/tags/})"
echo "Building docker tag: ${GITHUB_REF#refs/tags/}"
echo "buildTags=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
elif [[ $GITHUB_REF == refs/heads/* ]]; then
echo "This is a branch push (${GITHUB_REF#refs/heads/})"
echo "Building docker tags: ${{ env.BRANCH_BUILD_TAGS }}"
echo "buildTags=${{ env.BRANCH_BUILD_TAGS }}" >> $GITHUB_OUTPUT
else
echo "Unknown push type"
exit 1
fi
# dockerhub docker image build
build-dockerhub-image:
permissions:
contents: read
packages: write
id-token: write
attestations: write
name: "Build Docker Images and push them to DockerHub Registry"
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.build-docker-image.outputs.tags }}
digest: ${{ steps.build-docker-image.outputs.digest }}
timeout-minutes: 120
needs: parse-docker-build-env
steps:
- name: build docker image
uses: exo-actions/buildDockerImage-action/build-and-push-image@v1
id: build-docker-image
with:
dockerImage: "meedsio/meeds"
dockerImageTag: ${{ needs.parse-docker-build-env.outputs.buildTags }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
sign-dockerhub-image:
permissions:
contents: read
packages: write
id-token: write
strategy:
fail-fast: false
max-parallel: 1
matrix:
tags: ${{ fromJson(needs.build-dockerhub-image.outputs.tags) }}
name: "sign-docker-image"
runs-on: ubuntu-latest
timeout-minutes: 120
needs: build-dockerhub-image
steps:
- name: sign docker image
uses: exo-actions/buildDockerImage-action/sign-image@v1
id: sign-docker-image
with:
dockerImage: "meedsio/meeds"
dockerImageTag: ${{needs.build-dockerhub-image.outputs.tags}}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_PRIVATE_KEY_ID: ${{secrets.DOCKER_PRIVATE_KEY_ID}}
DOCKER_PRIVATE_KEY: ${{secrets.DOCKER_PRIVATE_KEY}}
DOCKER_PRIVATE_KEY_PASSPHRASE: ${{secrets.DOCKER_PRIVATE_KEY_PASSPHRASE}}
attest-dockerhub-image:
permissions:
contents: read
packages: write
id-token: write
attestations: write
name: "attest-docker-image"
runs-on: ubuntu-latest
timeout-minutes: 120
needs: build-dockerhub-image
steps:
- name: attest docker image
uses: exo-actions/buildDockerImage-action/attest-image@v1
id: attest-docker-image
with:
dockerImage: "meedsio/meeds"
dockerImageDigest: ${{ needs.build-dockerhub-image.outputs.digest }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
attestImage: "true"
cosign-dockerhub-image:
permissions:
contents: read
packages: write
id-token: write
attestations: write
name: "cosign-docker-image"
runs-on: ubuntu-latest
timeout-minutes: 120
needs: build-dockerhub-image
steps:
- name: attest docker image
uses: exo-actions/buildDockerImage-action/cosign-image@v1
id: cosign-docker-image
with:
dockerImage: "meedsio/meeds"
dockerImageTag: ${{ needs.build-dockerhub-image.outputs.tags }}
dockerImageDigest: ${{ needs.build-dockerhub-image.outputs.digest }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
cosignImage: "true"
cosignOidcImage: "true"
COSIGN_PRIVATE_KEY: ${{secrets.COSIGN_PRIVATE_KEY}}
COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}}
# ghcr docker image build
build-ghcr-image:
permissions:
contents: read
packages: write
id-token: write
attestations: write
name: "Build Docker Images and push them to ghcr Registry"
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.build-ghcr-image.outputs.tags }}
digest: ${{ steps.build-ghcr-image.outputs.digest }}
timeout-minutes: 120
needs: parse-docker-build-env
steps:
- name: build docker image
uses: exo-actions/buildDockerImage-action/build-and-push-image@v1
id: build-ghcr-image
with:
dockerImage: "meeds-io/meeds/meeds-io"
dockerImageTag: ${{ needs.parse-docker-build-env.outputs.buildTags }}
DOCKER_USERNAME: ${{ secrets.SWF_ACTOR }}
DOCKER_PASSWORD: ${{ secrets.SWF_TOKEN }}
dockerRegistry: "ghcr.io"
sign-ghcr-image:
permissions:
contents: read
packages: write
id-token: write
strategy:
fail-fast: false
max-parallel: 1
matrix:
tags: ${{ fromJson(needs.build-ghcr-image.outputs.tags) }}
name: "sign-docker-image"
runs-on: ubuntu-latest
timeout-minutes: 120
needs: build-ghcr-image
steps:
- name: sign docker image
uses: exo-actions/buildDockerImage-action/sign-image@v1
id: sign-docker-image
with:
dockerImage: "meeds-io/meeds/meeds-io"
dockerImageTag: ${{needs.build-ghcr-image.outputs.tags}}
DOCKER_USERNAME: ${{ secrets.SWF_ACTOR }}
DOCKER_PASSWORD: ${{ secrets.SWF_TOKEN }}
DOCKER_PRIVATE_KEY_ID: ${{secrets.DOCKER_PRIVATE_KEY_ID}}
DOCKER_PRIVATE_KEY: ${{secrets.DOCKER_PRIVATE_KEY}}
DOCKER_PRIVATE_KEY_PASSPHRASE: ${{secrets.DOCKER_PRIVATE_KEY_PASSPHRASE}}
dockerRegistry: "ghcr.io"
attest-ghcr-image:
permissions:
contents: read
packages: write
id-token: write
attestations: write
name: "attest-docker-image"
runs-on: ubuntu-latest
timeout-minutes: 120
needs: build-ghcr-image
steps:
- name: attest docker image
uses: exo-actions/buildDockerImage-action/attest-image@v1
id: attest-docker-image
with:
dockerImage: "meeds-io/meeds/meeds-io"
dockerImageDigest: ${{ needs.build-ghcr-image.outputs.digest }}
DOCKER_USERNAME: ${{ secrets.SWF_TOKEN }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
attestImage: "true"
dockerRegistry: "ghcr.io"
attestImageRegistry: "ghcr.io"
cosign-ghcr-image:
permissions:
contents: read
packages: write
id-token: write
attestations: write
name: "cosign-docker-image"
runs-on: ubuntu-latest
timeout-minutes: 120
needs: build-ghcr-image
steps:
- name: attest docker image
uses: exo-actions/buildDockerImage-action/cosign-image@v1
id: cosign-docker-image
with:
dockerImage: "meeds-io/meeds/meeds-io"
dockerImageTag: ${{ needs.build-ghcr-image.outputs.tags }}
dockerImageDigest: ${{ needs.build-ghcr-image.outputs.digest }}
DOCKER_USERNAME: ${{ secrets.SWF_ACTOR }}
DOCKER_PASSWORD: ${{ secrets.SWF_TOKEN }}
cosignImage: "true"
cosignOidcImage: "true"
COSIGN_PRIVATE_KEY: ${{secrets.COSIGN_PRIVATE_KEY}}
COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}}
dockerRegistry: "ghcr.io"