-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (46 loc) · 1.66 KB
/
sign.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
name: Sign Helm chart artifact
on:
workflow_dispatch:
push:
branches:
- main
jobs:
sign:
name: Sign ${{ matrix.case.name }}
runs-on: ubuntu-latest
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
case:
- name: TGZ Helm chart artifact
sign: |
cosign sign-blob -y my-app-1.0.0.tgz \
--bundle my-app-1.0.0.tgz.cosign.bundle
verify: |
cosign verify-blob my-app-1.0.0.tgz \
--bundle my-app-1.0.0.tgz.cosign.bundle \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
--certificate-identity "https://github.com/${GITHUB_WORKFLOW_REF}"
- name: OCI Helm chart artifact
sign: |
helm push my-app-1.0.0.tgz oci://ttl.sh/charts &> push-metadata.txt
CHART_DIGEST=$(awk '/Digest: /{print $2}' push-metadata.txt)
echo "CHART_DIGEST=${CHART_DIGEST}" | tee -a $GITHUB_ENV
cosign sign -y "ttl.sh/charts/my-app@${CHART_DIGEST}"
verify: |
cosign verify "ttl.sh/charts/my-app@${CHART_DIGEST}" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
--certificate-identity "https://github.com/${GITHUB_WORKFLOW_REF}"
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Cosign
uses: sigstore/cosign-installer@main
- name: Create Helm chart package
run : helm package charts/my-app
- name: Sign Helm chart package
run : ${{ matrix.case.sign }}
- name: Verify Helm chart package
run : ${{ matrix.case.verify }}