RandomChad/.github/workflows/deploy-website.yml
2021-10-16 13:49:29 +02:00

66 lines
1.4 KiB
YAML

name: Deploy Frontend on push/merge
# Only trigger on PR/push and only for frontend files
on:
# Trigger on PR close
pull_request:
types: [ closed ]
paths:
- 'src/**'
- 'modules/**'
branches:
- main
# Trigger on push to master (edge case, local merge)
push:
branches:
- main
paths:
- '*.json'
- '*.js'
- 'website/**'
- '.github/workflows/deploy-website.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: website
- 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: website
- name: test if all links work
run: npm test
working-directory: website
- name: Build website files
env:
NODE_ENV: production
run: npm run build
working-directory: website
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting:website
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}