Skip to content

Deploy to staging

Deploy to staging #463

name: Deploy to staging
on:
workflow_run:
workflows: ["End-to-End Test"]
branches: [develop]
types:
- completed
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: staging
if: ${{ github.event.workflow_run.conclusion == 'success' }}
env:
ADMG_ACCESS_TOKEN: ${{ secrets.ADMG_ACCESS_TOKEN }}
CYPRESS_password: ${{ secrets.CYPRESS_password }}
GATSBY_ADMG_CLIENT_ID: ${{ secrets.GATSBY_ADMG_CLIENT_ID }}
GATSBY_ADMG_CLIENT_SECRET: ${{ secrets.GATSBY_ADMG_CLIENT_SECRET }}
GATSBY_CPU_COUNT: 2
GATSBY_MAPBOX_TOKEN: ${{ secrets.GATSBY_MAPBOX_TOKEN }}
GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }}
GATSBY_ADMG_API: ${{ vars.GATSBY_ADMG_API }}
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2
- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
- name: Use Node.js ${{ steps.nvm.outputs.NVMRC }}
uses: actions/setup-node@v1
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Build
run: |
yarn install
yarn build
- name: Configure AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_ALICER_DEVSEED }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ALICER_DEVSEED }}
aws-region: "us-east-1"
- name: Deploy 🚀
run: |
aws s3 sync public s3://${{ secrets.STAGING_BUCKET }}/casei --acl public-read --follow-symlinks --delete
aws s3 cp s3://${{ secrets.STAGING_BUCKET }}/flight-tracks s3://${{ secrets.STAGING_BUCKET }}/casei/flight-tracks --recursive