-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (53 loc) · 1.49 KB
/
image.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
name: images
on:
workflow_call:
inputs:
target:
required: true
type: string
workflow_dispatch:
inputs:
target:
description: 'Target binary'
required: true
type: choice
options:
- terminal
- websocket
- namespace
- networkpolicy
- pod
- service
env:
COSIGN_EXPERIMENTAL: 1
KO_DOCKER_REPO: k8stty
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v3
- uses: sigstore/cosign-installer@main
- uses: ko-build/[email protected]
- uses: docker/[email protected]
with:
username: k8stty
password: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: ko build image
run: |
cd "src/cmd/${{ inputs.target }}"
ko build --base-import-paths --sbom spdx --image-refs=/tmp/images.txt .
- name: cosign sign
run: cosign sign $(cat /tmp/images.txt)
- name: fetch sbom
run: cosign download sbom $(cat /tmp/images.txt) > "/tmp/${{ inputs.target }}".spdx
- name: attest sbom
run: cosign attest --predicate "/tmp/${{ inputs.target }}".spdx $(cat /tmp/images.txt)