Release 0.10.0 build against collab env #94
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
name: Android Internal Build | |
run-name: ${{ github.event.inputs.buildname }} | |
env: | |
mimotoBackendServiceDefaultUrl: https://api.sandbox.mosip.net | |
esignetBackendServiceDefaultUrl: https://api.sandbox.mosip.net | |
on: | |
workflow_dispatch: | |
inputs: | |
buildname: | |
description: 'Build App For' | |
required: true | |
default: 'Sprint-x/Collab/release-x.x.x' | |
type: string | |
mimotoBackendServiceUrl: | |
description: 'Mimoto backend service URL' | |
required: true | |
default: 'https://api.sandbox.mosip.net' | |
type: string | |
esignetBackendServiceUrl: | |
description: 'Esignet backend service URL' | |
required: true | |
default: 'https://api.sandbox.mosip.net' | |
type: string | |
theme: | |
description: 'Application Theme' | |
required: true | |
default: 'orange' | |
type: choice | |
options: | |
- orange | |
- purple | |
buildDescription: | |
description: 'What to test' | |
required: true | |
default: 'QA-Triple environment' | |
type: string | |
registry_edit: | |
description: 'Edit Registry' | |
required: true | |
default: 'true' | |
type: choice | |
options: | |
- false | |
- true | |
jobs: | |
build-android: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
- name: Cache local npm repository | |
uses: actions/[email protected] | |
with: | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
path: ~/.npm | |
- name: Cache local gradle repository | |
uses: actions/[email protected] | |
with: | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
- name: Install npm dependencies | |
run: | | |
npm ci | |
- name: Create .env.local file | |
run: | | |
echo "${{ secrets.ENV_FILE }}" > .env.local > android/local.properties | |
- name: Setup branch and env | |
run: | | |
# Strip git ref prefix from version | |
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV | |
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV | |
- name: Setup branch and GPG public key | |
run: | | |
# Strip git ref prefix from version | |
echo ${{ env.BRANCH_NAME }} | |
echo ${{ env.GPG_TTY }} | |
sudo apt-get --yes install gnupg2 | |
gpg2 --import ./.github/keys/mosipgpgkey_pub.gpg | |
gpg2 --quiet --batch --passphrase=${{secrets.gpg_secret}} --allow-secret-key-import --import ./.github/keys/mosipgpgkey_sec.gpg | |
- name: Generate keystore | |
run: | | |
echo "$ANDROID_KEYSTORE_FILE" > release.keystore.b64 | |
base64 -d -i release.keystore.b64 > android/app/release.keystore | |
env: | |
ANDROID_KEYSTORE_FILE: ${{ secrets.INJI_ANDROID_RELEASE_KEYSTORE }} | |
- name: Export variables for keystore | |
run: | | |
cd android/app | |
export RELEASE_KEYSTORE_ALIAS=androidreleasekey | |
export RELEASE_KEYSTORE_PASSWORD=$RELEASE_KEYSTORE_PASSWORD | |
env: | |
RELEASE_KEYSTORE_PASSWORD: '${{secrets.INJI_ANDROID_RELEASE_STOREPASS}}' | |
- name: Create Google Play Config file | |
run: | | |
cd android | |
echo "$INJI_ANDROID_PLAY_STORE_CONFIG_JSON" > play_config.json.b64 | |
base64 -d -i play_config.json.b64 > play_config.json | |
env: | |
INJI_ANDROID_PLAY_STORE_CONFIG_JSON: ${{ secrets.INJI_ANDROID_PLAY_STORE_CONFIG_JSON }} | |
- name: Run Build | |
run: | | |
cd android/scripts | |
./internal-build.sh | |
env: | |
MIMOTO_HOST: ${{ github.event.inputs.mimotoBackendServiceUrl }} | |
ESIGNET_HOST: ${{ github.event.inputs.esignetBackendServiceUrl }} | |
APPLICATION_THEME: ${{ github.event.inputs.theme }} | |
RELEASE_KEYSTORE_ALIAS: androidreleasekey | |
RELEASE_KEYSTORE_PASSWORD: '${{secrets.INJI_ANDROID_RELEASE_STOREPASS}}' | |
SLACK_URL: '${{ secrets.SLACK_WEBHOOK_DEVOPS }}' | |
PLAY_CONSOLE_RELEASE_DESCRIPTION: ${{ github.event.inputs.buildDescription }} | |
CREDENTIAL_REGISTRY_EDIT: ${{ github.event.inputs.registry_edit }} | |
upload-to-actions: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
- name: Cache local npm repository | |
uses: actions/[email protected] | |
with: | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
path: ~/.npm | |
- name: Cache local gradle repository | |
uses: actions/[email protected] | |
with: | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
- name: Install npm dependencies | |
run: | | |
npm i | |
- name: Create .env.local file | |
run: | | |
echo "${{ secrets.ENV_FILE }}" > .env.local > android/local.properties | |
- name: Setup branch and env | |
run: | | |
# Strip git ref prefix from version | |
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV | |
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV | |
- name: Setup branch and GPG public key | |
run: | | |
# Strip git ref prefix from version | |
echo ${{ env.BRANCH_NAME }} | |
echo ${{ env.GPG_TTY }} | |
sudo apt-get --yes install gnupg2 | |
gpg2 --import ./.github/keys/mosipgpgkey_pub.gpg | |
gpg2 --quiet --batch --passphrase=${{secrets.gpg_secret}} --allow-secret-key-import --import ./.github/keys/mosipgpgkey_sec.gpg | |
- name: Generate keystore | |
run: | | |
echo "$ANDROID_KEYSTORE_FILE" > release.keystore.b64 | |
base64 -d -i release.keystore.b64 > android/app/release.keystore | |
env: | |
ANDROID_KEYSTORE_FILE: ${{ secrets.INJI_ANDROID_RELEASE_KEYSTORE }} | |
- name: Create Google Play Config file | |
run: | | |
cd android | |
echo "$INJI_ANDROID_PLAY_STORE_CONFIG_JSON" > play_config.json.b64 | |
base64 -d -i play_config.json.b64 > play_config.json | |
env: | |
INJI_ANDROID_PLAY_STORE_CONFIG_JSON: ${{ secrets.INJI_ANDROID_PLAY_STORE_CONFIG_JSON }} | |
- name: Run Build for upload | |
run: | | |
npx jetify | |
cd android | |
./gradlew :app:assembleMosipRelease | |
env: | |
MIMOTO_HOST: ${{ github.event.inputs.mimotoBackendServiceUrl }} | |
ESIGNET_HOST: ${{ github.event.inputs.esignetBackendServiceUrl }} | |
APPLICATION_THEME: ${{ github.event.inputs.theme }} | |
RELEASE_KEYSTORE_ALIAS: androidreleasekey | |
RELEASE_KEYSTORE_PASSWORD: '${{secrets.INJI_ANDROID_RELEASE_STOREPASS}}' | |
CREDENTIAL_REGISTRY_EDIT: ${{ github.event.inputs.registry_edit }} | |
- name: Upload Artifact | |
uses: actions/[email protected] | |
with: | |
name: ${{ github.event.inputs.buildname }} | |
path: android/app/build/outputs/apk/mosip/release/ | |
retention-days: 10 |