Skip to content

Commit 62c6181

Browse files
authored
Refactor keystore handling in release workflow
Updated the release workflow to conditionally handle keystore secrets and improved comments for clarity.
1 parent 59ba907 commit 62c6181

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,28 @@ jobs:
2727
cache: true
2828

2929
- name: Decode and install Keystore
30-
# FIX: The 'if' condition is simplified to correctly check for the secret.
31-
if: secrets.KEYSTORE_BASE64 != ''
30+
# This step now runs always, but the script inside is conditional.
31+
# We pass the secrets to environment variables.
32+
env:
33+
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
34+
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
35+
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
36+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
3237
run: |
33-
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > ${{ github.workspace }}/android/app/upload-keystore.jks
34-
echo "storeFile=${{ github.workspace }}/android/app/upload-keystore.jks" > ${{ github.workspace }}/android/key.properties
35-
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> ${{ github.workspace }}/android/key.properties
36-
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> ${{ github.workspace }}/android/key.properties
37-
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> ${{ github.workspace }}/android/key.properties
38+
# Use a shell 'if' to check if the secret env var is populated.
39+
if [ -n "$KEYSTORE_BASE64" ]; then
40+
echo "Keystore secret found, creating keystore and properties files."
41+
# Decode the base64 secret and create the keystore file
42+
echo "$KEYSTORE_BASE64" | base64 --decode > ${{ github.workspace }}/android/app/upload-keystore.jks
43+
44+
# Create the key.properties file with the other secrets
45+
echo "storeFile=${{ github.workspace }}/android/app/upload-keystore.jks" > ${{ github.workspace }}/android/key.properties
46+
echo "keyAlias=$KEY_ALIAS" >> ${{ github.workspace }}/android/key.properties
47+
echo "storePassword=$STORE_PASSWORD" >> ${{ github.workspace }}/android/key.properties
48+
echo "keyPassword=$KEY_PASSWORD" >> ${{ github.workspace }}/android/key.properties
49+
else
50+
echo "Keystore secret not found. Skipping app signing."
51+
fi
3852
3953
- name: Get Flutter dependencies
4054
run: flutter pub get

0 commit comments

Comments
 (0)