66jobs :
77 release :
88 permissions :
9- contents : write # for Releases/ index.yaml
9+ contents : write # for GitHub Releases / index.yaml
1010 packages : write # for GHCR
1111 runs-on : ubuntu-latest
1212
1313 steps :
14- # 1. Checkout
14+ # 1) Checkout
1515 - name : Checkout
1616 uses : actions/checkout@v4
1717 with :
1818 fetch-depth : 0
1919
20- # 2. Configure Git
20+ # 2) Configure Git
2121 - name : Configure Git
2222 run : |
2323 git config user.name "$GITHUB_ACTOR"
2424 git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
2525
26- # 3. Install Helm
26+ # 3) Install Helm CLI
2727 - name : Install Helm
2828 uses : azure/setup-helm@v4.3.0
2929
30- # 4. Import your ASCII-armored secret key (contains both public & private)
30+ # 4) Import your ASCII-armored secret key
3131 - name : Import GPG private key
3232 run : |
3333 echo "${{ secrets.GPG_PRIVATE_KEY }}" \
3434 | gpg --batch --yes --import
35- # Expects secrets.GPG_PRIVATE_KEY = output of:
36- # gpg --armor --export-secret-keys <KEYID> :contentReference[oaicite:5]{index=5}
35+ # imports both public & private material :contentReference[oaicite:1]{index=1}
3736
38- # 5. Enable loopback pinentry so --passphrase-file works in batchmode
39- - name : Enable GPG loopback pinentry
40- run : |
41- # Allow loopback in agent and gpg itself
42- printf "%s\n" "allow-loopback-pinentry" \
43- >> ~/.gnupg/gpg-agent.conf
44- printf "%s\n" "pinentry-mode loopback" \
45- >> ~/.gnupg/gpg.conf
46- # Restart the agent to pick up changes
47- gpgconf --kill gpg-agent
48- # Without this, GPG in batchmode cannot read passphrases :contentReference[oaicite:6]{index=6}
49-
50- # 6. Export legacy keyring files that Helm expects
37+ # 5) Export legacy keyrings for Helm provenance
5138 - name : Export legacy .gpg keyrings
5239 run : |
5340 mkdir -p ~/.gnupg
54- # Export public keys into legacy pubring.gpg
41+ # Public keyring:
5542 gpg --batch --yes --export "${{ secrets.CR_KEY }}" \
5643 > ~/.gnupg/pubring.gpg
57- # Export secret keys into legacy secring.gpg
44+ # Secret keyring:
5845 gpg --batch --yes --export-secret-keys "${{ secrets.CR_KEY }}" \
5946 > ~/.gnupg/secring.gpg
6047 ls -l ~/.gnupg/pubring.gpg ~/.gnupg/secring.gpg
61- # Helm’s provenance tooling looks for these hard-coded paths :contentReference[oaicite:7]{index=7}
48+ # Helm looks for these files by default :contentReference[oaicite:2]{index=2}
49+
50+ # 6) Install gpg-preset-passphrase and cache the passphrase
51+ - name : Cache GPG passphrase in agent
52+ run : |
53+ sudo apt-get update
54+ sudo apt-get install -y gnupg2-utils
55+ # Grab the first keygrip from your secret keyring
56+ KEYGRIP=$(gpg --with-keygrip -K "${{ secrets.CR_KEY }}" \
57+ | awk '/Keygrip/ { print $3; exit }')
58+ # Preset the passphrase into gpg-agent
59+ echo "${{ secrets.GPG_PASSPHRASE }}" \
60+ | gpg-preset-passphrase --preset --passphrase-fd 0 "$KEYGRIP"
61+ # gpg-preset-passphrase caches your passphrase so gpg can sign non-interactively :contentReference[oaicite:3]{index=3}
6262
63- # 7. Package & sign each chart
63+ # 7) Package & sign charts (no more batchmode errors)
6464 - name : Package & sign charts
6565 shell : bash
6666 run : |
@@ -70,31 +70,30 @@ jobs:
7070 --sign \
7171 --key "${{ secrets.CR_KEY }}" \
7272 --keyring ~/.gnupg/secring.gpg \
73- --passphrase-file <(echo "${{ secrets.GPG_PASSPHRASE }}") \
7473 --destination .cr-release-packages
7574 done
76- # Now GPG will read the passphrase and keyring non-interactively :contentReference[oaicite:8 ]{index=8 }
75+ # Since agent has the passphrase, no prompts occur :contentReference[oaicite:4 ]{index=4 }
7776
78- # 8. Publish the signed charts (no re-packaging )
77+ # 8) Publish the signed charts (skip repackaging )
7978 - name : Publish signed charts
8079 uses : helm/chart-releaser-action@v1.7.0
8180 with :
8281 skip_existing : true
8382 skip_packaging : true
8483 env :
8584 CR_TOKEN : ${{ secrets.GITHUB_TOKEN }}
86- CR_SIGN : false # Already signed above :contentReference[oaicite:9]{index=9}
85+ CR_SIGN : false # already signed
8786
88- # 9. Login to GHCR for OCI pushes
87+ # 9) Login to GHCR for OCI pushes
8988 - name : Login to GHCR
9089 uses : docker/login-action@v3
9190 with :
92- registry : ghcr.io
93- username : ${{ github.actor }}
94- password : ${{ secrets.GITHUB_TOKEN }}
91+ registry : ghcr.io
92+ username : ${{ github.actor }}
93+ password : ${{ secrets.GITHUB_TOKEN }}
9594
96- # 10. Push OCI charts to GHCR
95+ # 10) Push OCI charts to GHCR
9796 - name : Push Charts to GHCR
9897 shell : bash
9998 run : |
100- for
99+ for pkg in .cr-release-packages/*; do
0 commit comments