Skip to content

Merge pull request #39 from centre-for-effective-altruism/gwwc-login-… #42

Merge pull request #39 from centre-for-effective-altruism/gwwc-login-…

Merge pull request #39 from centre-for-effective-altruism/gwwc-login-… #42

Workflow file for this run

name: deploy
on:
push:
branches:
- dev
- master
jobs:
build:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 14
# See https://www.maxivanov.io/github-actions-deploy-to-multiple-environments-from-single-workflow/
- name: Set environment vars (staging)
if: endsWith(github.ref, '/dev')
run: |
echo "AUTH0_DOMAIN=${{ secrets.STAGING__AUTH0_DOMAIN}}" >> $GITHUB_ENV
echo "AUTH0_CLIENT_ID=${{ secrets.STAGING__AUTH0_CLIENT_ID}}" >> $GITHUB_ENV
echo "AUTH0_CLIENT_SECRET=${{ secrets.STAGING__AUTH0_CLIENT_SECRET}}" >> $GITHUB_ENV
- name: Set environment vars (production)
if: endsWith(github.ref, '/master')
run: |
echo "AUTH0_DOMAIN=${{ secrets.PRODUCTION__AUTH0_DOMAIN}}" >> $GITHUB_ENV
echo "AUTH0_CLIENT_ID=${{ secrets.PRODUCTION__AUTH0_CLIENT_ID}}" >> $GITHUB_ENV
echo "AUTH0_CLIENT_SECRET=${{ secrets.PRODUCTION__AUTH0_CLIENT_SECRET}}" >> $GITHUB_ENV
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn dependencies
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install packages
run: yarn --prefer-offline
- name: Build CLI and rule definitions
run: yarn build
- name: Diff changes
env:
TOKEN_NAMESPACE: ${{ secrets.TOKEN_NAMESPACE }}
run: yarn cli rules diff && yarn cli db diff && yarn cli login diff
- name: Deploy
env:
TOKEN_NAMESPACE: ${{ secrets.TOKEN_NAMESPACE }}
run:
yarn cli rules deploy && yarn cli db deploy && yarn cli login deploy