|
50 | 50 | platforms: linux/${{ matrix.arch }} |
51 | 51 | tags: fontebasso/php-nginx:${{ steps.version.outputs.tag }}-${{ matrix.arch }} |
52 | 52 | push: true |
53 | | - provenance: false |
| 53 | + provenance: true |
| 54 | + attests: true |
| 55 | + sbom: true |
54 | 56 | build-args: | |
55 | 57 | VERSION=${{ steps.version.outputs.tag }} |
56 | 58 |
|
@@ -91,107 +93,3 @@ jobs: |
91 | 93 | COSIGN_EXPERIMENTAL: "1" |
92 | 94 | run: | |
93 | 95 | cosign sign --yes docker.io/fontebasso/php-nginx@${{ steps.push.outputs.digest }} |
94 | | -
|
95 | | - attach-sbom: |
96 | | - name: Generate and Attach SBOM |
97 | | - needs: merge-multiarch |
98 | | - runs-on: ubuntu-latest |
99 | | - steps: |
100 | | - - name: Install Syft |
101 | | - uses: anchore/sbom-action/[email protected] |
102 | | - |
103 | | - - name: Install Cosign |
104 | | - |
105 | | - |
106 | | - - name: Log in to Docker Hub |
107 | | - uses: docker/login-action@v3 |
108 | | - with: |
109 | | - username: ${{ secrets.DOCKERHUB_USERNAME }} |
110 | | - password: ${{ secrets.DOCKERHUB_TOKEN }} |
111 | | - |
112 | | - - name: Generate SBOM (Syft JSON) |
113 | | - run: | |
114 | | - syft docker.io/fontebasso/php-nginx@${{ needs.merge-multiarch.outputs.digest }} \ |
115 | | - -o spdx-json > sbom.spdx.json |
116 | | -
|
117 | | - - name: Attest SBOM |
118 | | - run: | |
119 | | - cosign attest \ |
120 | | - --yes \ |
121 | | - --type spdx \ |
122 | | - --predicate sbom.spdx.json \ |
123 | | - docker.io/fontebasso/php-nginx@${{ needs.merge-multiarch.outputs.digest }} |
124 | | -
|
125 | | - - name: Upload SBOM artifact |
126 | | - uses: actions/upload-artifact@v4 |
127 | | - with: |
128 | | - name: 'sbom' |
129 | | - path: sbom.spdx.json |
130 | | - |
131 | | - - name: Sign SBOM |
132 | | - env: |
133 | | - COSIGN_EXPERIMENTAL: "1" |
134 | | - run: | |
135 | | - cosign sign --yes \ |
136 | | - --attachment sbom \ |
137 | | - docker.io/fontebasso/php-nginx@${{ needs.merge-multiarch.outputs.digest }} |
138 | | -
|
139 | | - generate-provenance: |
140 | | - name: Generate SLSA Provenance |
141 | | - needs: merge-multiarch |
142 | | - if: startsWith(github.ref, 'refs/tags/') |
143 | | - uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] |
144 | | - with: |
145 | | - image: docker.io/fontebasso/php-nginx |
146 | | - digest: ${{ needs.merge-multiarch.outputs.digest }} |
147 | | - secrets: |
148 | | - registry-username: ${{ secrets.DOCKERHUB_USERNAME }} |
149 | | - registry-password: ${{ secrets.DOCKERHUB_TOKEN }} |
150 | | - permissions: |
151 | | - packages: write |
152 | | - id-token: write |
153 | | - contents: read |
154 | | - actions: read |
155 | | - |
156 | | - publish-assets: |
157 | | - name: Publish SBOM and Provenance to Release |
158 | | - needs: [ attach-sbom, generate-provenance, merge-multiarch ] |
159 | | - runs-on: ubuntu-latest |
160 | | - permissions: |
161 | | - contents: write |
162 | | - steps: |
163 | | - - name: Extract release version |
164 | | - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV |
165 | | - |
166 | | - - name: Install Cosign |
167 | | - |
168 | | - |
169 | | - - name: Download provenance from registry |
170 | | - run: | |
171 | | - cosign download attestation \ |
172 | | - docker.io/fontebasso/php-nginx@${{ needs.merge-multiarch.outputs.digest }} \ |
173 | | - --output-file provenance.intoto.jsonl |
174 | | -
|
175 | | - - name: Download SBOM artifact |
176 | | - uses: actions/download-artifact@v4 |
177 | | - with: |
178 | | - name: 'sbom' |
179 | | - |
180 | | - - name: Save digest to file |
181 | | - run: echo "${{ needs.merge-multiarch.outputs.digest }}" > digest.txt |
182 | | - |
183 | | - - name: Generate checksums |
184 | | - run: | |
185 | | - sha256sum \ |
186 | | - provenance.intoto.jsonl \ |
187 | | - sbom.spdx.json \ |
188 | | - digest.txt > checksums.txt |
189 | | -
|
190 | | - - name: Upload release assets |
191 | | - uses: softprops/action-gh-release@v2 |
192 | | - with: |
193 | | - files: | |
194 | | - provenance.intoto.jsonl |
195 | | - sbom.spdx.json |
196 | | - digest.txt |
197 | | - checksums.txt |
0 commit comments