-
Notifications
You must be signed in to change notification settings - Fork 3
58 lines (55 loc) · 1.89 KB
/
Copy pathdockerhub.yml
File metadata and controls
58 lines (55 loc) · 1.89 KB
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
---
name: Docker Hub
on:
push:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
permissions: {}
jobs:
dockerhub:
if: startsWith(github.ref, 'refs/heads/')
runs-on: ubuntu-latest
strategy:
matrix:
platform: ["linux/amd64", "linux/arm64"]
tag: ["main", "latest"]
steps:
- name: Set IMAGE
shell: bash
run: |
set -euo pipefail
IFS=$'\n\t'
echo "IMAGE=${GITHUB_REPOSITORY#*/docker-}" >> "${GITHUB_ENV}"
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 1
persist-credentials: false
- name: Pull the ${{ matrix.tag }} ${{ matrix.platform }} image
shell: bash
env:
PLATFORM: ${{ matrix.platform }}
TAG: ${{ matrix.tag }}
run: |
set -euo pipefail
IFS=$'\n\t'
docker pull --platform "${PLATFORM}" "${GITHUB_REPOSITORY_OWNER}/${IMAGE}:${TAG}"
- name: Pull the ${{ matrix.tag }} ${{ matrix.platform }} image SBOM
shell: bash
env:
PLATFORM: ${{ matrix.platform }}
TAG: ${{ matrix.tag }}
run: |
set -euo pipefail
IFS=$'\n\t'
docker buildx imagetools inspect "${GITHUB_REPOSITORY_OWNER}/${IMAGE}:${TAG}" --format "{{ json (index .SBOM \"${PLATFORM}\").SPDX }}"
- name: Install cosign
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
- name: Verify the ${{ matrix.tag }} image signature
shell: bash
env:
TAG: ${{ matrix.tag }}
run: |
set -euo pipefail
IFS=$'\n\t'
cosign verify "${GITHUB_REPOSITORY_OWNER}/${IMAGE}:${TAG}" --certificate-identity-regexp "https://github\.com/${GITHUB_REPOSITORY}/\.github/workflows/.+" --certificate-oidc-issuer 'https://token.actions.githubusercontent.com'