Skip to content

Commit c04be7b

Browse files
authored
feat: support for empty app name and android.injected.signing properties (#12)
1 parent e8cf87f commit c04be7b

File tree

2 files changed

+74
-6
lines changed

2 files changed

+74
-6
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,52 @@ jobs:
7474
| `artifact-url` | URL of the build artifact |
7575
| `artifact-id` | ID of the build artifact |
7676

77+
## Code Signing
78+
79+
When `sign: true` is enabled, this action configures Android code signing by setting Gradle properties. It supports **two property conventions** for maximum compatibility:
80+
81+
### Android injected properties
82+
83+
(this is an undocumented feature used by Fastlane and AGP)
84+
85+
The action automatically sets `android.injected.signing.*` properties which are natively recognized by the Android Gradle Plugin. These properties work with any standard `build.gradle` configuration without modifications:
86+
87+
```gradle
88+
signingConfigs {
89+
release {
90+
// These hardcoded values will be automatically overridden
91+
storeFile file('path/to/keystore.jks')
92+
keyAlias 'placeholder'
93+
storePassword 'placeholder'
94+
keyPassword 'placeholder'
95+
}
96+
}
97+
```
98+
99+
### Custom ROCK Properties
100+
101+
For apps that explicitly read custom properties in their `build.gradle`, the action also sets `ROCK_UPLOAD_*` properties:
102+
103+
```gradle
104+
signingConfigs {
105+
release {
106+
storeFile file('path/to/keystore.jks')
107+
keyAlias project.findProperty('ROCK_UPLOAD_KEY_ALIAS') ?: 'placeholder'
108+
storePassword project.findProperty('ROCK_UPLOAD_STORE_PASSWORD') ?: 'placeholder'
109+
keyPassword project.findProperty('ROCK_UPLOAD_KEY_PASSWORD') ?: 'placeholder'
110+
}
111+
}
112+
```
113+
114+
The following mappings are set:
115+
116+
- `ROCK_UPLOAD_KEY_ALIAS``inputs.keystore-key-alias`
117+
- `ROCK_UPLOAD_STORE_FILE``inputs.keystore-store-file`
118+
- `ROCK_UPLOAD_STORE_PASSWORD``inputs.keystore-store-password`
119+
- `ROCK_UPLOAD_KEY_PASSWORD``inputs.keystore-key-password`
120+
121+
Both conventions are set simultaneously, so the action works with any existing build configuration.
122+
77123
## Prerequisites
78124

79125
- Ubuntu runner

action.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,18 @@ runs:
183183
run: |
184184
mkdir -p $HOME/.gradle
185185
touch $HOME/.gradle/gradle.properties
186-
echo "RNEF_UPLOAD_STORE_FILE=${{ inputs.keystore-store-file }}" >> $HOME/.gradle/gradle.properties
187-
echo "RNEF_UPLOAD_STORE_PASSWORD=${{ inputs.keystore-store-password }}" >> $HOME/.gradle/gradle.properties
188-
echo "RNEF_UPLOAD_KEY_ALIAS=${{ inputs.keystore-key-alias }}" >> $HOME/.gradle/gradle.properties
189-
echo "RNEF_UPLOAD_KEY_PASSWORD=${{ inputs.keystore-key-password }}" >> $HOME/.gradle/gradle.properties
186+
187+
# Android standard properties (auto-recognized by AGP)
188+
echo "android.injected.signing.store.file=${{ inputs.keystore-store-file }}" >> $HOME/.gradle/gradle.properties
189+
echo "android.injected.signing.store.password=${{ inputs.keystore-store-password }}" >> $HOME/.gradle/gradle.properties
190+
echo "android.injected.signing.key.alias=${{ inputs.keystore-key-alias }}" >> $HOME/.gradle/gradle.properties
191+
echo "android.injected.signing.key.password=${{ inputs.keystore-key-password }}" >> $HOME/.gradle/gradle.properties
192+
193+
# Rock custom properties (for apps that explicitly read them in signingConfigs)
194+
echo "ROCK_UPLOAD_STORE_FILE=${{ inputs.keystore-store-file }}" >> $HOME/.gradle/gradle.properties
195+
echo "ROCK_UPLOAD_STORE_PASSWORD=${{ inputs.keystore-store-password }}" >> $HOME/.gradle/gradle.properties
196+
echo "ROCK_UPLOAD_KEY_ALIAS=${{ inputs.keystore-key-alias }}" >> $HOME/.gradle/gradle.properties
197+
echo "ROCK_UPLOAD_KEY_PASSWORD=${{ inputs.keystore-key-password }}" >> $HOME/.gradle/gradle.properties
190198
shell: bash
191199

192200
- name: Determine Android sourceDir and appName
@@ -204,15 +212,25 @@ runs:
204212
- name: Decode and store keystore file
205213
if: ${{ !env.ARTIFACT_URL && inputs.sign }}
206214
run: |
207-
KEYSTORE_TARGET_PATH="$ANDROID_SOURCE_DIR/$APP_NAME/${{ inputs.keystore-path }}"
215+
if [ -n "$APP_NAME" ]; then
216+
KEYSTORE_TARGET_PATH="$ANDROID_SOURCE_DIR/$APP_NAME/${{ inputs.keystore-path }}"
217+
else
218+
KEYSTORE_TARGET_PATH="$ANDROID_SOURCE_DIR/${{ inputs.keystore-path }}"
219+
fi
220+
221+
echo "Keystore target path before normalizing: $KEYSTORE_TARGET_PATH"
222+
KEYSTORE_TARGET_PATH=$(realpath -m "$KEYSTORE_TARGET_PATH")
223+
echo "Keystore target path after normalizing: $KEYSTORE_TARGET_PATH"
208224
mkdir -p "$(dirname "$KEYSTORE_TARGET_PATH")" || {
209225
echo "Failed to create keystore directory: $(dirname "$KEYSTORE_TARGET_PATH")"
210226
exit 1
211227
}
212228
if [ -n "${{ inputs.keystore-file }}" ]; then
213229
cp "${{ inputs.keystore-file }}" "$KEYSTORE_TARGET_PATH"
230+
echo "Successfully copied keystore file to target path: $KEYSTORE_TARGET_PATH"
214231
else
215232
echo "${{ inputs.keystore-base64 }}" | base64 --decode > "$KEYSTORE_TARGET_PATH"
233+
echo "Successfully copied keystore base64 to target path: $KEYSTORE_TARGET_PATH"
216234
fi
217235
shell: bash
218236
working-directory: ${{ inputs.working-directory }}
@@ -312,7 +330,11 @@ runs:
312330
if: ${{ !env.ARTIFACT_URL && inputs.sign }}
313331
run: |
314332
rm $HOME/.gradle/gradle.properties
315-
rm "$ANDROID_SOURCE_DIR/$APP_NAME/${{ inputs.keystore-path }}"
333+
if [ -n "$APP_NAME" ]; then
334+
rm "$ANDROID_SOURCE_DIR/$APP_NAME/${{ inputs.keystore-path }}"
335+
else
336+
rm "$ANDROID_SOURCE_DIR/${{ inputs.keystore-path }}"
337+
fi
316338
shell: bash
317339
working-directory: ${{ inputs.working-directory }}
318340

0 commit comments

Comments
 (0)