@@ -14,13 +14,34 @@ jobs:
14
14
permissions :
15
15
packages : write
16
16
contents : read
17
+ id-token : write
18
+ environment : azure-publish
17
19
steps :
18
20
- name : Harden Runner
19
21
uses : step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
20
22
with :
21
23
egress-policy : audit
22
24
- name : Checkout
23
25
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
26
+ - name : Install Notation
27
+ uses : notaryproject/notation-action/setup@03242349f62aeddc995e12c6fbcea3b87697873f # v1.2.0
28
+ - name : Install cosign
29
+ uses : sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
30
+ - name : Az CLI login
31
+ uses : azure/login@a65d910e8af852a8061c627c456678983e180302 # v2.2.0
32
+ with :
33
+ client-id : ${{ secrets.AZURE_CLIENT_ID }}
34
+ tenant-id : ${{ secrets.AZURE_TENANT_ID }}
35
+ subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
36
+ - name : Cache AAD tokens
37
+ run : |
38
+ az version
39
+ # Key Vault:
40
+ az account get-access-token --scope https://vault.azure.net/.default --output none
41
+ - name : Prepare notation certificate
42
+ run : |
43
+ mkdir -p truststore/x509/ca/ratify-verify
44
+ cp ./.well-known/pki-validation/ratify-verification.crt truststore/x509/ca/ratify-verify
24
45
- name : prepare
25
46
id : prepare
26
47
run : |
@@ -83,6 +104,49 @@ jobs:
83
104
--label org.opencontainers.image.revision=${{ github.sha }} \
84
105
-t ${{ steps.prepare.outputs.ref }} \
85
106
--push .
107
+ - name : Sign with Notation
108
+ uses : notaryproject/notation-action/sign@03242349f62aeddc995e12c6fbcea3b87697873f # v1.2.0
109
+ with :
110
+ plugin_name : azure-kv
111
+ plugin_url : ${{ vars.AZURE_KV_PLUGIN_URL }}
112
+ plugin_checksum : ${{ vars.AZURE_KV_CHECKSUM }}
113
+ key_id : ${{ secrets.AZURE_KV_KEY_ID }}
114
+ target_artifact_reference : |-
115
+ ${{ steps.prepare.outputs.crdref }}
116
+ ${{ steps.prepare.outputs.baseref }}
117
+ ${{ steps.prepare.outputs.ref }}
118
+ signature_format : cose
119
+ - name : Sign with Cosign
120
+ run : |
121
+ cosign sign --yes ${{ steps.prepare.outputs.crdref }}
122
+ cosign sign --yes ${{ steps.prepare.outputs.baseref }}
123
+ cosign sign --yes ${{ steps.prepare.outputs.ref }}
124
+ - name : Verify with Notation
125
+ uses : notaryproject/notation-action/verify@03242349f62aeddc995e12c6fbcea3b87697873f # v1.2.0
126
+ with :
127
+ target_artifact_reference : |-
128
+ ${{ steps.prepare.outputs.crdref }}
129
+ ${{ steps.prepare.outputs.baseref }}
130
+ ${{ steps.prepare.outputs.ref }}
131
+ trust_policy : ./.well-known/pki-validation/trustpolicy.json
132
+ trust_store : truststore
133
+ - name : Verify with Cosign
134
+ run : |
135
+ cosign verify \
136
+ --certificate-identity-regexp "https://github.com/ratify-project/ratify/.github/workflows/publish-package.yml@*" \
137
+ --certificate-oidc-issuer https://token.actions.githubusercontent.com \
138
+ --certificate-github-workflow-repository ratify-project/ratify \
139
+ ${{ steps.prepare.outputs.crdref }}
140
+ cosign verify \
141
+ --certificate-identity-regexp "https://github.com/ratify-project/ratify/.github/workflows/publish-package.yml@*" \
142
+ --certificate-oidc-issuer https://token.actions.githubusercontent.com \
143
+ --certificate-github-workflow-repository ratify-project/ratify \
144
+ ${{ steps.prepare.outputs.baseref }}
145
+ cosign verify \
146
+ --certificate-identity-regexp "https://github.com/ratify-project/ratify/.github/workflows/publish-package.yml@*" \
147
+ --certificate-oidc-issuer https://token.actions.githubusercontent.com \
148
+ --certificate-github-workflow-repository ratify-project/ratify \
149
+ ${{ steps.prepare.outputs.ref }}
86
150
- name : clear
87
151
if : always()
88
152
run : |
0 commit comments