Deployment #154
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 source file is part of the PAWS application based on the Stanford Spezi Template Application project | |
# | |
# SPDX-FileCopyrightText: 2023 Stanford University | |
# | |
# SPDX-License-Identifier: MIT | |
# | |
name: Deployment | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: | | |
The GitHub deployment environment. | |
required: true | |
default: 'development' | |
type: choice | |
options: | |
- development | |
- staging | |
- production | |
workflow_call: | |
inputs: | |
environment: | |
description: | | |
The GitHub deployment environment. | |
required: false | |
type: string | |
default: staging | |
concurrency: | |
group: deployment | |
cancel-in-progress: false | |
jobs: | |
determineenvironment: | |
name: Determine Environment | |
runs-on: ubuntu-latest | |
outputs: | |
environment: ${{ steps.set-env.outputs.environment }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Determine Environment | |
id: set-env | |
run: | | |
if [[ -z "${{ inputs.environment }}" ]]; then | |
echo "environment=staging" >> $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: | |
FIREBASE_PROJECT_ID: ${{ vars.FIREBASE_PROJECT_ID }} | |
steps: | |
- run: | | |
echo "Injecting Environment Variables In Deployment Workflow: ${{ vars.FIREBASE_PROJECT_ID }}" | |
buildandtest: | |
name: Build and Test | |
needs: determineenvironment | |
uses: ./.github/workflows/build-and-test.yml | |
permissions: | |
contents: read | |
actions: read | |
security-events: write | |
secrets: inherit | |
iosapptestflightdeployment: | |
name: iOS App TestFlight Deployment | |
needs: [determineenvironment, vars, buildandtest] | |
uses: StanfordBDHG/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 | |
permissions: | |
contents: read | |
with: | |
runsonlabels: '["macOS", "self-hosted"]' | |
environment: ${{ needs.determineenvironment.outputs.environment }} | |
googleserviceinfoplistpath: 'PAWS/Supporting Files/GoogleService-Info.plist' | |
setupsigning: true | |
setupfirebaseemulator: true | |
firebaseemulatorimport: ./firebase --project ${{ needs.vars.outputs.FIREBASE_PROJECT_ID }} | |
fastlanelane: deploy environment:"${{ needs.determineenvironment.outputs.environment }}" | |
secrets: inherit | |
deployfirebase: | |
name: Deploy Firebase Project | |
needs: [determineenvironment, vars, iosapptestflightdeployment] | |
uses: StanfordBDHG/.github/.github/workflows/firebase-deploy.yml@v2 | |
permissions: | |
contents: read | |
with: | |
environment: ${{ needs.determineenvironment.outputs.environment }} | |
arguments: '--project ${{ needs.vars.outputs.FIREBASE_PROJECT_ID }}' | |
secrets: | |
GOOGLE_APPLICATION_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }} |