@@ -167,13 +167,6 @@ jobs:
167
167
username : ${{ github.actor }}
168
168
password : ${{ secrets.GITHUB_TOKEN }}
169
169
170
- - name : Login to Quay.io
171
- uses : docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
172
- with :
173
- registry : quay.io
174
- username : ${{ secrets.QUAY_USERNAME }}
175
- password : ${{ secrets.QUAY_PASSWORD }}
176
-
177
170
- uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
178
171
with :
179
172
go-version-file : " go.mod"
@@ -188,30 +181,42 @@ jobs:
188
181
with :
189
182
cosign-release : " v2.2.2"
190
183
191
- - name : Prepare
192
- run : |
193
- echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
194
- echo "REPOS"="quay.io/grafana-operator/grafana-operator" "ghcr.io/${{ github.repository }}" >> $GITHUB_ENV
195
-
196
184
- name : Build and push
197
185
env :
198
186
IMAGE_VERSION : ${{ github.ref_name }}
187
+ KO_DOCKER_REPO : " ghcr.io/${{ github.repository }}"
199
188
run : |
200
- for i in ${{ env.REPOS }}
201
- do
202
- export KO_DOCKER_REPO=${i}
203
- ko build --sbom=spdx --image-refs ./image-digest-${i%.*} --bare --platform linux/arm64,linux/arm/v7,linux/amd64,linux/ppc64le -t ${IMAGE_VERSION} \
189
+ ko build --sbom=spdx --image-refs ./image-digest --bare --platform linux/arm64,linux/arm/v7,linux/amd64,linux/ppc64le -t ${IMAGE_VERSION} \
204
190
--image-label org.opencontainers.image.title=grafana-operator \
205
191
--image-label org.opencontainers.image.description="An operator for Grafana that installs and manages Grafana instances & Dashboards & Datasources through Kubernetes/OpenShift CRs" \
206
192
--image-label org.opencontainers.image.url=${{ github.server_url }}/${{ github.repository }} \
207
193
--image-label org.opencontainers.image.revision=${{ github.sha }} \
208
194
--image-label org.opencontainers.image.version=${IMAGE_VERSION} \
209
- --image-label org.opencontainers.image.created=${{ env.BUILD_DATE }}
210
- done
195
+ --image-label org.opencontainers.image.created="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
211
196
212
197
- name : Sign Image
213
198
run : |
214
- for i in ${{ env.REPOS }}
215
- do
216
- cosign sign -d -y $(cat ./image-digest-${i%.*})
217
- done
199
+ cosign sign -d -y $(cat ./image-digest)
200
+
201
+ distribute-to-quay :
202
+ runs-on : ubuntu-latest
203
+ needs :
204
+ - image
205
+ permissions :
206
+ packages : read
207
+ steps :
208
+ - name : Copy image to quay
209
+ env :
210
+ IMAGE_VERSION : ${{ github.ref_name }}
211
+ DOCKER_REPO : " ghcr.io/${{ github.repository }}"
212
+ GHCR_USERNAME : ${{ github.actor }}
213
+ GHCR_PASSWORD : ${{ secrets.GITHUB_TOKEN }}
214
+ QUAY_USERNAME : ${{ secrets.QUAY_USERNAME }}
215
+ QUAY_PASSWORD : ${{ secrets.QUAY_PASSWORD }}
216
+ run : |
217
+ docker run -it --rm quay.io/containers/skopeo:v1.18.0 \
218
+ copy --multi-arch all \
219
+ --source-creds "$GHCR_USERNAME:$GHCR_PASSWORD" \
220
+ --dest-creds "$QUAY_USERNAME:$QUAY_PASSWORD" \
221
+ docker://${DOCKER_REPO}:${IMAGE_VERSION} \
222
+ docker://quay.io/grafana-operator/grafana-operator:${IMAGE_VERSION}
0 commit comments