Skip to content

Commit

Permalink
Improve Deployment Setup (#40)
Browse files Browse the repository at this point in the history
# Improve Deployment Setup

## ⚙️ Release Notes 
- Switch from Firebase App Hosting to Firebase Hosting

### Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).

---------

Co-authored-by: Arkadiusz Bachorski <60391032+arkadiuszbachorski@users.noreply.github.com>
  • Loading branch information
PSchmiedmayer and arkadiuszbachorski authored Sep 10, 2024
1 parent 8d8078f commit 3168b31
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 33 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#
# This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
#
# SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# 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: development

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
checks: write
secrets: inherit
deployfirebase:
name: Deploy Firebase Project
needs: [buildandtest, determineenvironment, vars]
uses: StanfordBDHG/.github/.github/workflows/firebase-deploy.yml@envFirebase
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 }}
33 changes: 0 additions & 33 deletions .github/workflows/main.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
#
# SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
#

name: Production Deployment

on:
workflow_dispatch:
push:
tags:
- "*"

concurrency:
group: production
cancel-in-progress: false

jobs:
deployment:
name: Production Deployment
uses: ./.github/workflows/deployment.yml
permissions:
contents: read
actions: read
security-events: write
secrets: inherit
with:
environment: production

0 comments on commit 3168b31

Please sign in to comment.