RandomChad/.github/workflows/deploy-viewer.yml
2022-06-09 10:16:22 +02:00

65 lines
1.5 KiB
YAML

name: Deploy viewer on push/merge
# Only trigger on PR/push and only for frontend files
on:
# Trigger on PR close
pull_request:
types: [ closed ]
paths:
- 'viewer/*.json'
- 'viewer/*.js'
- 'viewer/**'
- '.github/workflows/deploy-viewer.yml'
branches:
- main
# Trigger on push to master (edge case, local merge)
push:
branches:
- main
paths:
- 'viewer/*.json'
- 'viewer/*.js'
- 'viewer/**'
- '.github/workflows/deploy-viewer.yml'
jobs:
# Build the frontend giles
build:
name: Compile frontend
runs-on: ubuntu-latest
steps:
# Get the repo files from current commit
- name: Cloning repository
uses: actions/checkout@v1
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
working-directory: viewer
- name: Set Node.js (.nvmrc)
uses: actions/setup-node@v1
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
- name: Install dependencies
run: npm i
working-directory: viewer
- name: Build website files
env:
NODE_ENV: production
CI: false
run: npm run build
working-directory: viewer
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting:viewer
env:
GCP_SA_KEY: ${{ secrets.FIREBASE_DEPLOYMENT_GCP_KEY }}