Skip to content

Commit 08a720d

Browse files
committed
Sign chart with cosign
Signed-off-by: Matheus Pimenta <[email protected]>
1 parent 3832a76 commit 08a720d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/release.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ jobs:
99
release:
1010
permissions:
1111
contents: write
12-
packages: write
12+
packages: write # for pushing to GHCR
13+
id-token: write # for signing with cosign
1314
runs-on: ubuntu-latest
1415
steps:
1516
- name: Checkout
1617
uses: actions/checkout@v5
1718
with:
1819
fetch-depth: 0
1920

21+
- name: Setup Cosign
22+
uses: sigstore/[email protected]
23+
2024
- name: Configure Git
2125
run: |
2226
git config user.name "$GITHUB_ACTOR"
@@ -42,12 +46,15 @@ jobs:
4246
username: ${{ github.actor }}
4347
password: ${{ secrets.GITHUB_TOKEN }}
4448

45-
- name: Push Charts to GHCR
49+
- name: Push Charts to GHCR and Sign
4650
run: |
4751
shopt -s nullglob
4852
for pkg in .cr-release-packages/*; do
4953
if [ -z "${pkg:-}" ]; then
5054
break
5155
fi
52-
helm push "${pkg}" oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts
56+
chart_name=$(echo "${pkg##*/}" | sed 's/-[0-9].*$//')
57+
repo="oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts"
58+
helm push "${pkg}" "${repo}" |& grep Digest: | awk '{print $NF}' > digest.txt
59+
cosign sign --yes "${repo}/${chart_name}@$(cat digest.txt)"
5360
done

0 commit comments

Comments
 (0)