Commit fd1132e3 authored by David Burke's avatar David Burke

Added Android build steps #203

parent 01b16884
Pipeline #41240449 failed with stages
in 5 minutes and 49 seconds
......@@ -50,6 +50,38 @@ build-ext-assets:
- web-ext-artifacts/
- dist-ext/
build_android:
image: runmymind/docker-android-sdk:ubuntu-standalone
variables:
NODE_VERSION: 10.14.2
stage: test
only:
- master
- staging
script:
- git submodule update --init --recursive
- wget -q http://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz
- tar -xzf node-v${NODE_VERSION}-linux-x64.tar.gz
- mv node-v${NODE_VERSION}-linux-x64 /opt/node
- rm node-v${NODE_VERSION}-linux-x64.tar.gz
- PATH=${PATH}:/opt/node/bin
- npm install -g nativescript --unsafe-perm
- npm install nativescript --unsafe-perm
- $ANDROID_HOME/tools/bin/sdkmanager "tools" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "extras;google;m2repository" > /dev/null
- npm ci
- echo "build version code $CI_PIPELINE_IID"
- sed -i '/versionCode/c\ android:versionCode="'"$CI_PIPELINE_IID"'"' app/App_Resources/Android/AndroidManifest.xml
- if [[ -v CI_COMMIT_TAG ]]; then sed -i '/versionName/c\ android:versionName="'"$CI_COMMIT_TAG"'">' app/App_Resources/Android/AndroidManifest.xml; fi;
- ./fix_sodium.sh
- echo $ANDROID_KEY_BASE64 | base64 -d > bsc-release-key.jks
- tns build android --release --bundle --env.snapshot --env.aot --key-store-path bsc-release-key.jks --key-store-password $ANDROID_KEY_PASSWORD --key-store-alias-password $ANDROID_KEY_PASSWORD --key-store-alias bsc
artifacts:
paths:
- platforms/android/app/build/outputs/apk/
cache:
paths:
- .npm/
build-push-docker:
stage: docker
image: docker:stable
......@@ -126,6 +158,19 @@ deploy-firefox-ext:
- npm install @wext/shipit
- npm run ext:publish_firefox
deploy-google-play:
stage: deploy
image: debian:stretch
dependencies:
- build_android
only:
- master
when: manual
script:
- apt-get update
- apt-get -y install curl jq
- bin/deploy_play.sh
pages:
stage: pages
cache:
......
#!/bin/bash
echo "Get access token for client id ${ANDROID_CLIENT_ID}"
ACCESS_TOKEN=$(curl "https://accounts.google.com/o/oauth2/token" -d "client_id=${ANDROID_CLIENT_ID}&client_secret=${ANDROID_CLIENT_SECRET}&refresh_token=${ANDROID_REFRESH_TOKEN}&grant_type=refresh_token&redirect_uri=urn:ietf:wg:oauth:2.0:oob" | jq -r .access_token)
echo "Create new edit for ${packageName}"
EDIT_ID=$(curl -H "Authorization: Bearer ${ANDROID_ACCESS_TOKEN}" -X POST https://www.googleapis.com/androidpublisher/v3/applications/${packageName}/edits | jq -r .id)
echo "Upload apk to Google Play for edit id ${EDIT_ID}"
curl -H "Authorization: Bearer ${ANDROID_ACCESS_TOKEN}" -X POST --header "Content-Type:application/vnd.android.package-archive" -T platforms/android/app/build/outputs/apk/release/app-release.apk -v "https://www.googleapis.com/upload/androidpublisher/v3/applications/${packageName}/edits/${EDIT_ID}/apks?uploadType=media"
echo "Submit apk to Beta Track for edit id ${EDIT_ID}"
curl -H "Authorization: Bearer ${ANDROID_ACCESS_TOKEN}" -X PUT -v "https://www.googleapis.com/androidpublisher/v3/applications/${packageName}/edits/${CI_PIPELINE_IID}/tracks/beta"
echo "Commit edit id ${EDIT_ID}"
curl -H "Authorization: Bearer ${ANDROID_ACCESS_TOKEN}" -X POST https://www.googleapis.com/androidpublisher/v3/applications/${packageName}/edits/${EDIT_ID}:commit
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment