File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 3030 mkdir -p ~/.gnupg
3131 chmod 700 ~/.gnupg
3232 echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf
33- echo "${{ secrets.HELM_RSA_PRIVATE_KEY }}" | base64 -d | gpg --batch --import
34- echo "${{ secrets.HELM_RSA_PASSPHRASE }}" | gpg --batch --passphrase-fd 0 --export-secret-keys > ~/.gnupg/secring.gpg
33+
34+ # Clean and decode the private key (remove whitespace/newlines)
35+ echo "Importing GPG private key..."
36+ echo "${{ secrets.HELM_RSA_PRIVATE_KEY }}" | tr -d ' \n\r' | base64 -d 2>/dev/null | gpg --batch --import
37+
38+ # Verify key was imported
39+ if ! gpg --list-secret-keys "$GPG_KEY_ID" >/dev/null 2>&1; then
40+ echo "❌ Failed to import GPG key"
41+ echo "Please verify that HELM_RSA_PRIVATE_KEY contains valid base64-encoded private key"
42+ exit 1
43+ fi
44+
45+ # Export secret keys for Helm
46+ echo "$GPG_PASSPHRASE" | gpg --batch --passphrase-fd 0 --export-secret-keys > ~/.gnupg/secring.gpg
47+
48+ echo "✅ GPG key imported successfully"
3549
3650 - name : Package and Sign Charts
3751 run : |
5367 echo "pinentry-mode loopback" > ~/.gnupg/gpg.conf
5468
5569 # Import the RSA public key for verification
56- echo "${{ secrets.HELM_RSA_PRIVATE_KEY }}" | base64 -d | gpg --batch --import
70+ echo "${{ secrets.HELM_RSA_PRIVATE_KEY }}" | tr -d ' \n\r' | base64 -d 2>/dev/null | gpg --batch --import
5771
5872 # Create the public keyring that helm verify expects
5973 gpg --batch --export > ~/.gnupg/pubring.gpg
You can’t perform that action at this time.
0 commit comments