Add manual deployment for beta and prod environments #14
Workflow file for this run
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
name: Deploy to Firebase Hosting | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: 'Choose an environment to deploy' | |
required: true | |
default: 'dev' | |
type: choice | |
options: | |
- dev | |
- beta | |
- prod | |
permissions: | |
checks: write | |
contents: read | |
pull-requests: write | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache Dependencies | |
id: cache_npm | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
- name: Install dependencies | |
if: steps.cache_npm.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Build UI | |
run: npx grunt prepareFW | |
- name: Deploy to Firebase Hosting | |
uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
repoToken: ${{ secrets.GITHUB_TOKEN }} | |
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_OPENSPRINKLER_UI }} | |
projectId: opensprinkler-ui | |
target: ${{ | |
github.event_name == 'workflow_dispatch' && ( | |
github.event.inputs.environment == 'prod' && 'opensprinkler-ui' || | |
github.event.inputs.environment == 'beta' && 'opensprinkler-betaui' || | |
'opensprinkler-devui' | |
) || 'opensprinkler-devui' }} | |
channelId: ${{ github.event_name == 'push' && 'live' || '' }} |