Skip to content

Udpate Setup

Udpate Setup #71

Workflow file for this run

#
# This source file is part of the Stanford Spezi open-source project
#
# SPDX-FileCopyrightText: 2024 Stanford University
#
# SPDX-License-Identifier: MIT
#
name: Main
on:
push:
branches:
- main
- feature/deployemnt
workflow_dispatch:
inputs:
environment:
description: |
The GitHub deployment environment.
required: true
default: 'internal'
type: choice
options:
- internal
- staging
- production
workflow_call:
inputs:
environment:
description: |
The GitHub deployment environment.
required: false
type: string
default: staging
concurrency:
group: main
cancel-in-progress: false
jobs:
determineenvironment:
name: Determine Environment
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.determineenvironment.outputs.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Determine Environment
id: determineenvironment
run: |
if [[ -z "${{ inputs.environment }}" ]]; then
echo "environment=internal" >> $GITHUB_OUTPUT
else
echo "environment=${{ inputs.environment }}" >> $GITHUB_OUTPUT
fi
vars:
name: Inject Environment Variables In Deployment Workflow
needs: determineenvironment
runs-on: ubuntu-latest
environment: ${{ needs.determineenvironment.outputs.environment }}
outputs:
appidentifier: ${{ vars.APP_IDENTIFIER }}
steps:
- run: |
echo "Injecting Environment Variables In Deployment Workflow:"
echo "appidentifier: ${{ vars.APP_IDENTIFIER }}"
# buildtestandanalyze:
# uses: ./.github/workflows/build-test-analyze.yml
# secrets: inherit
googleplayinternal:
name: Upload App to Google Play - Internal
runs-on: ubuntu-latest
# needs: buildtestandanalyze
needs: [determineenvironment, vars]
environment: ${{ needs.determineenvironment.outputs.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: '17'
cache: gradle
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Decode and Write Google Service JSON
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $GOOGLE_SERVICES_JSON | base64 --decode >./app/google-services.json
- name: Decode and Write Secrets
env:
SECRETS_XML: ${{ secrets.SECRETS_XML }}
run: echo $SECRETS_XML | base64 --decode >./modules/account/src/main/res/values/secrets.xml
- name: Setup keystore file
env:
KEY_STORE: ${{ secrets.KEY_STORE }}
run: |
echo $KEY_STORE | base64 -d > keystore.jks
echo $KEY_STORE | base64 -d > app/keystore.jks
- name: Build and Deploy
env:
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
SERVICE_ACCOUNT_JSON_KEY: ${{ secrets.SERVICE_ACCOUNT_JSON_KEY }}
run: bundle exec fastlane internal environment:"${{ needs.determineenvironment.outputs.environment }}" applicationid:"${{ needs.vars.outputs.appidentifier }}"