Skip to content

Commit

Permalink
Merge pull request #66 from CQEN-QDCE/feat/pipeline-android
Browse files Browse the repository at this point in the history
Android deployment
  • Loading branch information
jcdrouin21 authored Jan 17, 2023
2 parents e23a3da + d259894 commit ba24c93
Show file tree
Hide file tree
Showing 4 changed files with 452 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ jobs:
- name: Ship to Google Play
if: github.ref_name == 'main' && needs.check-android-secrets.outputs.isReleaseBuild == 'true'
working-directory: app/android
working-directory: app/
env:
GOOGLE_API_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_API_CREDENTIALS_BASE64 }}
GOOGLE_API_CREDENTIALS: "api_keys.json"
Expand All @@ -352,7 +352,7 @@ jobs:
VERSION_NAME: ${{ env.appBuildVersion }}
run: |
echo "${GOOGLE_API_CREDENTIALS_BASE64}" | base64 -d >${GOOGLE_API_CREDENTIALS} && \
./deploy-to-playstore.js
node ./deploy-to-playstore.js
- name: Ship to SauceLabs
if: github.ref_name == 'main' && needs.check-android-secrets.outputs.isReleaseBuild == 'true'
Expand Down
18 changes: 6 additions & 12 deletions app/android/deploy-to-playstore.js → app/deploy-to-playstore.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
#!/usr/bin/env node

// This script will upload to a Google Play release track. See
// the Google Developer API documentation reference here:
// https://developers.google.com/android-publisher/api-ref/rest

const fs = require('fs')
const { google } = require('googleapis')

const pjson = require('./package.json')

if (typeof process.env.GOOGLE_API_CREDENTIALS === 'undefined') {
console.log(`
Google Publish v${_version}
Google Publish v${pjson.version}
GOOGLE_API_CREDENTIALS cannot be empty
Set the env var GOOGLE_API_CREDENTIALS to the full path of the
JSON credentials (keys) downloaded from the GCP console.
Expand All @@ -22,7 +16,7 @@ if (typeof process.env.GOOGLE_API_CREDENTIALS === 'undefined') {

if (typeof process.env.ANDROID_PACKAGE_NAME === 'undefined') {
console.log(`
Google Publish v${_version}
Google Publish v${pjson.version}
ANDROID_PACKAGE_NAME cannot be empty
Set the env var ANDROID_PACKAGE_NAME to the full package name
used in the Android project.
Expand All @@ -33,7 +27,7 @@ if (typeof process.env.ANDROID_PACKAGE_NAME === 'undefined') {

if (typeof process.env.ANDROID_BUNDLE_PATH === 'undefined') {
console.log(`
Google Publish v${_version}
Google Publish v${pjson.version}
ANDROID_BUNDLE_PATH cannot be empty
Set the env var ANDROID_BUNDLE_PATH to the full path to the
bundle (aab) file produced by the build.
Expand All @@ -44,7 +38,7 @@ if (typeof process.env.ANDROID_BUNDLE_PATH === 'undefined') {

if (typeof process.env.VERSION_NAME === 'undefined') {
console.log(`
Google Publish v${_version}
Google Publish v${pjson.version}
VERSION_NAME cannot be empty
Set the env var VERSION_NAME to the full version name
eg: 1.0.2
Expand All @@ -60,7 +54,7 @@ const main = async () => {
const packageName = process.env.ANDROID_PACKAGE_NAME
const bundlePath = process.env.ANDROID_BUNDLE_PATH

console.log(`Google Publish v${_version}`)
console.log(`Google Publish v${pjson.version}`)

try {
console.log('Creating Google API client.')
Expand All @@ -87,7 +81,7 @@ const main = async () => {
})

console.log('Loading bundle data.')
const bundle = readFileSync(bundlePath)
const bundle = fs.readFileSync(bundlePath)

console.log('Uploading bundle data to Edit.')
await play.edits.bundles.upload({
Expand Down
Loading

0 comments on commit ba24c93

Please sign in to comment.