Skip to content

Commit e8cf87f

Browse files
authored
feat: add keystore-path param (#11)
* feat: add keystore-path param * docs: add keystore-path info * chore: additional error handling * docs: add keystore-path info
1 parent 8c2cb70 commit e8cf87f

File tree

2 files changed

+31
-20
lines changed

2 files changed

+31
-20
lines changed

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,29 @@ jobs:
4343
# keystore-store-password: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
4444
# keystore-key-alias: 'your-key-alias'
4545
# keystore-key-password: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
46+
# keystore-path: 'tools/buildtools/upload-key.keystore' # Optional: for custom keystore locations
4647
```
4748

4849
## Inputs
4950

50-
| Input | Description | Required | Default |
51-
| ------------------------- | ---------------------------------------- | -------- | ------- |
52-
| `github-token` | GitHub Token | Yes | - |
53-
| `working-directory` | Working directory for the build command | No | `.` |
54-
| `validate-gradle-wrapper` | Whether to validate the Gradle wrapper | No | `true` |
55-
| `setup-java` | Whether to run actions/setup-java action | No | `true` |
56-
| `variant` | Build variant (debug/release) | No | `debug` |
57-
| `sign` | Whether to sign the build with keystore | No | - |
58-
| `re-sign` | Re-sign the APK with new JS bundle | No | `false` |
59-
| `keystore-file` | Path to the keystore file | No | - |
60-
| `keystore-base64` | Base64 encoded keystore file | No | - |
61-
| `keystore-store-file` | Keystore store file name | No | - |
62-
| `keystore-store-password` | Keystore store password | No | - |
63-
| `keystore-key-alias` | Keystore key alias | No | - |
64-
| `keystore-key-password` | Keystore key password | No | - |
65-
| `rock-build-extra-params` | Extra parameters for rock build:android | No | - |
66-
| `comment-bot` | Whether to comment PR with build link | No | `true` |
51+
| Input | Description | Required | Default |
52+
| ------------------------- | ---------------------------------------- | -------- | ------------------ |
53+
| `github-token` | GitHub Token | Yes | - |
54+
| `working-directory` | Working directory for the build command | No | `.` |
55+
| `validate-gradle-wrapper` | Whether to validate the Gradle wrapper | No | `true` |
56+
| `setup-java` | Whether to run actions/setup-java action | No | `true` |
57+
| `variant` | Build variant (debug/release) | No | `debug` |
58+
| `sign` | Whether to sign the build with keystore | No | - |
59+
| `re-sign` | Re-sign the APK with new JS bundle | No | `false` |
60+
| `keystore-file` | Path to the keystore file | No | - |
61+
| `keystore-base64` | Base64 encoded keystore file | No | - |
62+
| `keystore-store-file` | Keystore store file name | No | - |
63+
| `keystore-store-password` | Keystore store password | No | - |
64+
| `keystore-key-alias` | Keystore key alias | No | - |
65+
| `keystore-key-password` | Keystore key password | No | - |
66+
| `keystore-path` | where the keystore should be placed | No | `release.keystore` |
67+
| `rock-build-extra-params` | Extra parameters for rock build:android | No | - |
68+
| `comment-bot` | Whether to comment PR with build link | No | `true` |
6769

6870
## Outputs
6971

action.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ inputs:
5252
keystore-key-password:
5353
description: 'Keystore key password'
5454
required: false
55+
keystore-path:
56+
description: 'Path within the Android source directory where the keystore should be placed'
57+
required: false
58+
default: 'release.keystore'
5559
comment-bot:
5660
description: 'Whether to send a comment under PR with the link to the generated build'
5761
required: false
@@ -200,10 +204,15 @@ runs:
200204
- name: Decode and store keystore file
201205
if: ${{ !env.ARTIFACT_URL && inputs.sign }}
202206
run: |
207+
KEYSTORE_TARGET_PATH="$ANDROID_SOURCE_DIR/$APP_NAME/${{ inputs.keystore-path }}"
208+
mkdir -p "$(dirname "$KEYSTORE_TARGET_PATH")" || {
209+
echo "Failed to create keystore directory: $(dirname "$KEYSTORE_TARGET_PATH")"
210+
exit 1
211+
}
203212
if [ -n "${{ inputs.keystore-file }}" ]; then
204-
cp "${{ inputs.keystore-file }}" $ANDROID_SOURCE_DIR/$APP_NAME/release.keystore
213+
cp "${{ inputs.keystore-file }}" "$KEYSTORE_TARGET_PATH"
205214
else
206-
echo "${{ inputs.keystore-base64 }}" | base64 --decode > $ANDROID_SOURCE_DIR/$APP_NAME/release.keystore
215+
echo "${{ inputs.keystore-base64 }}" | base64 --decode > "$KEYSTORE_TARGET_PATH"
207216
fi
208217
shell: bash
209218
working-directory: ${{ inputs.working-directory }}
@@ -303,7 +312,7 @@ runs:
303312
if: ${{ !env.ARTIFACT_URL && inputs.sign }}
304313
run: |
305314
rm $HOME/.gradle/gradle.properties
306-
rm $ANDROID_SOURCE_DIR/$APP_NAME/release.keystore
315+
rm "$ANDROID_SOURCE_DIR/$APP_NAME/${{ inputs.keystore-path }}"
307316
shell: bash
308317
working-directory: ${{ inputs.working-directory }}
309318

0 commit comments

Comments
 (0)