Skip to content

Commit dad1114

Browse files
committed
try using on the fly gpg key generation
1 parent 98844a1 commit dad1114

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

.github/workflows/main.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,40 @@ jobs:
7878
java-version: '17'
7979
distribution: 'temurin'
8080

81+
- name: Generate Dummy GPG Key
82+
run: |
83+
# Generate GPG key details
84+
cat >key-details <<EOF
85+
%echo Generating a dummy OpenPGP key
86+
Key-Type: RSA
87+
Key-Length: 2048
88+
Name-Real: Dummy User
89+
Name-Comment: For testing
90+
Name-Email: dummy@example.com
91+
Expire-Date: 0
92+
%no-protection
93+
%commit
94+
%echo done
95+
EOF
96+
97+
# Generate the dummy GPG key
98+
gpg --batch --generate-key key-details
99+
100+
# Retrieve the key ID
101+
KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep '^sec' | awk '{print $2}' | awk -F'/' '{print $2}')
102+
103+
# Export the key in ASCII-armored format
104+
gpg --armor --export-secret-keys "$KEY_ID" > private.key
105+
106+
# Set environment variables for Gradle
107+
echo "SIGNING_KEY=$(cat private.key)" >> $GITHUB_ENV
108+
echo "SIGNING_KEY_ID=$KEY_ID" >> $GITHUB_ENV
109+
81110
- name: Dry Run Release
82111
run: ./gradlew clean assembleBundle -info --stacktrace
83112
env:
84-
SIGNING_KEY: "dummy key for dry run"
85-
SIGNING_PASSWORD: "dummy pw for dry run"
113+
# Set Gradle signing properties via environment variables
114+
ORG_GRADLE_PROJECT_signingKey: ${{ env.SIGNING_KEY }}
115+
ORG_GRADLE_PROJECT_signingPassword: ""
116+
ORG_GRADLE_PROJECT_signingKeyId: ${{ env.SIGNING_KEY_ID }}
117+

0 commit comments

Comments
 (0)