-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add auto-upload of release APKs via CI/CD #495
Open
allan-on
wants to merge
9
commits into
master
Choose a base branch
from
cicd-auto-apk-upload
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9ffb06f
:wrench: Add signing configs
allan-on 600e862
:construction_worker: Add Release Workflow Yaml
allan-on 5035558
:construction_worker: Update release password & keystore configs
allan-on 10b75ea
:memo: Add link to publishing apk via git tag
allan-on 0114195
:construction_worker: Update release signing keystore configs
allan-on c196347
:construction_worker: Update keystore name
allan-on 04f863f
:green_heart: Add properties file
allan-on 6529a0d
:green_heart: Ignore properties file
allan-on 2bbb538
:green_heart: Update keystore properties in gradle build
allan-on File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# This workflow will build a Java project with Gradle | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | ||
|
||
name: APK Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v[0-9]+.[0-9]+.[0-9]+ | ||
- v[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+ | ||
- v[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+-[0-9a-zA-Z]+ | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }} | ||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | ||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cancel previous workflow runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- name: Decode Keystore file | ||
run: echo $ENCODED_KEYSTORE | base64 -di > "${HOME}"/ona.keystore.jks | ||
env: | ||
ENCODED_KEYSTORE: ${{ secrets.KEYSTORE_FILE }} | ||
|
||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11 | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Decode & Generate keystore.properties file | ||
run: echo $KEYSTORE_PROPERTIES | base64 -di > keystore.properties | ||
env: | ||
KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }} | ||
|
||
- name: Decode google-services.json | ||
env: | ||
FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }} | ||
run: echo $FIREBASE_CONFIG > opensrp-giz-malawi/google-services.json | ||
|
||
- name: Generate AAB (Android App Bundle) file | ||
run: ./gradlew :opensrp-giz-malawi:bundleRelease -x :opensrp-giz-malawi:testDebugUnitTest --stacktrace | ||
|
||
- name: Upload AAB file to tag assets | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: android/opensrp-giz-malawi/build/outputs/bundle/release/opensrp-giz-malawi-release.aab | ||
asset_name: "opensrp-giz-malawi-$tag.aab" | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
|
||
- name: Generate APK (Android App PacKage) file | ||
run: ./gradlew :opensrp-giz-malawi:assembleRelease -x :opensrp-giz-malawi:testDebugUnitTest --stacktrace | ||
working-directory: android | ||
|
||
- name: Upload APK file to tag assets | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: android/opensrp-giz-malawi/build/outputs/apk/release/opensrp-giz-malawi-release.apk | ||
asset_name: "opensrp-giz-malawi-$tag.apk" | ||
tag: ${{ github.ref }} | ||
prerelease: ${{ contains(github.ref, '-alpha') || contains(github.ref, '-beta') }} | ||
overwrite: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
ext.props = new Properties() | ||
|
||
//KEYSTORE CREDENTIALS | ||
def keystoreAuthArray = ["KEYSTORE_ALIAS", "KEY_PASSWORD", "KEYSTORE_PASSWORD"] | ||
if (rootProject.file("keystore.properties").exists()) { | ||
props.load(rootProject.file("keystore.properties").newDataInputStream()) | ||
|
||
keystoreAuthArray.each { arrayProp -> project.ext.set(arrayProp, props.getProperty(arrayProp, "sample")) | ||
} | ||
} else { | ||
println("keystore.properties does not exist. The following values are required " + keystoreAuthArray.join(", ")) | ||
keystoreAuthArray.each { arrayProp -> project.ext.set(arrayProp, props.getProperty(arrayProp, "sample_" + arrayProp)) | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we also add the
oauth.client.id
andoauth.client.secret
to thelocal.properties
file?