Skip to content

Commit cd450db

Browse files
committed
Update publish.yml to decode GPG key from base64 and set as multiline environment variable
1 parent 16faa4a commit cd450db

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/publish.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,19 @@ jobs:
7070
- name: Validate Gradle Wrapper
7171
uses: gradle/actions/wrapper-validation@v3
7272

73-
# This assumes the GPG key is stored as a base64-encoded string in the secret
73+
# Decode the base64 encoded GPG key from secrets and save to temporary file
74+
# Start multiline environment variable for GitHub Actions
75+
# Add the decoded GPG key content to the environment variable
76+
# End the multiline environment variable
77+
# Clean up temporary file for security
7478
- name: Set up GPG key
7579
env:
7680
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
7781
run: |
78-
echo "$GPG_KEY_CONTENTS" | base64 -d > /tmp/gpg_key.asc
79-
echo "ORG_GRADLE_PROJECT_signingInMemoryKey=$(cat /tmp/gpg_key.asc)" >> $GITHUB_ENV
82+
echo "$GPG_KEY_CONTENTS" | base64 -d > /tmp/gpg_key.asc
83+
echo "ORG_GRADLE_PROJECT_signingInMemoryKey<<EOF" >> $GITHUB_ENV
84+
cat /tmp/gpg_key.asc >> $GITHUB_ENV
85+
echo "EOF" >> $GITHUB_ENV
8086
rm /tmp/gpg_key.asc
8187
8288
- name: Cache Gradle and Konan

0 commit comments

Comments
 (0)