Skip to content

Deploy to Staging

Deploy to Staging #58

name: Deploy to Staging
on:
push:
branches:
- staging
workflow_dispatch:
jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
NODE_OPTIONS: --unhandled-rejections=strict
steps:
- uses: actions/checkout@v2
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v2
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
run: npm ci
- name: Run Tests
run: npm test
deploy:
name: Deploy
needs: test
runs-on: ubuntu-latest
env:
NODE_OPTIONS: --unhandled-rejections=strict
steps:
- uses: actions/checkout@v2
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v2
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
run: npm ci
- name: Generate staging.env
env:
SENTRY_AUTH_TOKEN: ${{ secrets.STAGING_SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.STAGING_SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.STAGING_SENTRY_PROJECT }}
SENTRY_DSN: ${{ secrets.STAGING_SENTRY_DSN }}
run: envsubst < staging.env.sample > staging.env
- name: Fetch data
run: git clone https://github.com/botblock/data
- name: Publish to Staging
run: npm run publish:staging
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}