-
Notifications
You must be signed in to change notification settings - Fork 5
Add support for keystore file input #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
03ff7e3
6f42100
cbd6f0b
f377973
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,9 @@ inputs: | |
| keystore-base64: | ||
| description: 'Base64 version of the release keystore' | ||
| required: false | ||
| keystore-file: | ||
| description: 'Path to the keystore file' | ||
| required: false | ||
| keystore-store-file: | ||
| description: 'Keystore store file name' | ||
| required: false | ||
|
|
@@ -68,8 +71,14 @@ runs: | |
| - name: Validate Inputs | ||
| run: | | ||
| if [ "${{ inputs.sign }}" == "true" ]; then | ||
| if [ -z "${{ inputs.keystore-base64 }}" ]; then | ||
| echo "Input 'keystore-base64' is required for signed builds." | ||
| if [ -z "${{ inputs.keystore-file }}" ] && [ -z "${{ inputs.keystore-base64 }}" ]; then | ||
| echo "Either 'keystore-file' or 'keystore-base64' is required for signed builds." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Validate keystore file actually exists if provided | ||
| if [ -n "${{ inputs.keystore-file }}" ] && [ ! -f "${{ inputs.keystore-file }}" ]; then | ||
| echo "Keystore file '${{ inputs.keystore-file }}' does not exist." | ||
| exit 1 | ||
| fi | ||
|
|
||
|
|
@@ -116,7 +125,6 @@ runs: | |
| mkdir -p .rock/cache | ||
| echo "{\"githubToken\": \"${{ inputs.github-token }}\"}" > .rock/cache/project.json | ||
| shell: bash | ||
|
|
||
| # We create PR-related artifacts to avoid overwriting the main artifact with new JS bundle | ||
| - name: Check if PR-related artifact exists | ||
| if: ${{ github.event_name == 'pull_request' && inputs.re-sign == 'true' }} | ||
|
|
@@ -131,7 +139,7 @@ runs: | |
| echo "ARTIFACT_NAME=$(echo "$OUTPUT" | jq -r '.name')" >> $GITHUB_ENV | ||
| fi | ||
| shell: bash | ||
|
|
||
| - name: Check if regular artifact exists | ||
| if: ${{ !env.ARTIFACT_NAME }} | ||
| run: | | ||
|
|
@@ -145,7 +153,6 @@ runs: | |
| echo "ARTIFACT_NAME=$(echo "$OUTPUT" | jq -r '.name')" >> $GITHUB_ENV | ||
| fi | ||
| shell: bash | ||
|
|
||
| - name: Set Artifact Name (if not set) | ||
| if: ${{ !env.ARTIFACT_NAME }} | ||
| run: | | ||
|
|
@@ -193,8 +200,13 @@ runs: | |
| - name: Decode and store keystore file | ||
| if: ${{ !env.ARTIFACT_URL && inputs.sign }} | ||
| run: | | ||
| echo "${{ inputs.keystore-base64 }}" | base64 --decode > $ANDROID_SOURCE_DIR/$APP_NAME/release.keystore | ||
| if [ -n "${{ inputs.keystore-file }}" ]; then | ||
| cp "${{ inputs.keystore-file }}" $ANDROID_SOURCE_DIR/$APP_NAME/release.keystore | ||
| else | ||
| echo "${{ inputs.keystore-base64 }}" | base64 --decode > $ANDROID_SOURCE_DIR/$APP_NAME/release.keystore | ||
| fi | ||
| shell: bash | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the ANDROID_SOURCE_DIR is absolute path, but let's add working-directory here for consistency here and in "Clean Up Keystore and gradle properties (signed builds only)" step
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, updated 👍 |
||
| working-directory: ${{ inputs.working-directory }} | ||
|
|
||
| - name: Build Android | ||
| if: ${{ !env.ARTIFACT_URL }} | ||
|
|
@@ -212,7 +224,7 @@ runs: | |
| echo APK_PATH $APK_PATH | ||
| echo "ARTIFACT_PATH=$APK_PATH" >> $GITHUB_ENV | ||
| shell: bash | ||
|
|
||
| - name: Download and Unpack APK | ||
| if: ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' && github.event_name == 'pull_request' }} | ||
| run: | | ||
|
|
@@ -240,7 +252,6 @@ runs: | |
| echo "ARTIFACT_ID=$(echo "$OUTPUT" | jq -r '.id')" >> $GITHUB_ENV | ||
| fi | ||
| shell: bash | ||
|
|
||
| # Special case for GitHub, as it doesn't support uploading through the API | ||
| - name: Upload Artifact to GitHub | ||
| id: upload-artifact | ||
|
|
@@ -279,6 +290,7 @@ runs: | |
| rm $HOME/.gradle/gradle.properties | ||
| rm $ANDROID_SOURCE_DIR/$APP_NAME/release.keystore | ||
| shell: bash | ||
| working-directory: ${{ inputs.working-directory }} | ||
|
|
||
| - name: Post Build | ||
| if: ${{ github.event_name == 'pull_request' && inputs.comment-bot == 'true' }} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Keystore Path Validation Ignores Working Directory
The keystore file validation and copy operations don't respect the
working-directoryinput. This means relative paths forkeystore-fileare resolved from the repository root, leading to validation and copy failures when aworking-directoryis specified.Additional Locations (1)
action.yml#L199-L208