Skip to content

Deploy Sanity Suite #158

Deploy Sanity Suite

Deploy Sanity Suite #158

name: Deploy Sanity Suite
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: What sanity suite environment to deploy (pre-release checks done on staging)
required: true
options:
- production
- staging
permissions:
id-token: write # allows the JWT to be requested from GitHub's OIDC provider
contents: read # This is required for actions/checkout
env:
NODE_OPTIONS: '--no-warnings'
jobs:
deploy-tag:
name: Deploy Sanity Suite
runs-on: [self-hosted, Linux, X64]
steps:
- name: Install AWS cli
uses: unfor19/install-aws-cli-action@master
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_PROD_ACCOUNT_ID }}:role/${{ secrets.AWS_PROD_S3_SYNC_ROLE }}
aws-region: us-east-1
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install dependencies
env:
HUSKY: 0
run: |
npm run setup:ci
- name: Build staging artifacts
if: inputs.environment == 'staging'
env:
WRITE_KEY: ${{ secrets.SANITY_SUITE_WRITE_KEY }}
DATAPLANE_URL: ${{ secrets.SANITY_SUITE_DATAPLANE_URL }}
CONFIG_SERVER_HOST: ${{ secrets.SANITY_SUITE_CONFIG_SERVER_HOST }}
BUGSNAG_API_KEY: ${{ secrets.RS_STAGING_BUGSNAG_API_KEY }}
BUGSNAG_RELEASE_STAGE: 'development'
HUSKY: 0
run: |
npm run build:package
npm run build:sanity:staging
- name: Build production artifacts
if: inputs.environment == 'production'
env:
WRITE_KEY: ${{ secrets.SANITY_SUITE_WRITE_KEY }}
DATAPLANE_URL: ${{ secrets.SANITY_SUITE_DATAPLANE_URL }}
CONFIG_SERVER_HOST: ${{ secrets.SANITY_SUITE_CONFIG_SERVER_HOST }}
BUGSNAG_API_KEY: ${{ secrets.RS_PROD_BUGSNAG_API_KEY }}
BUGSNAG_RELEASE_STAGE: 'production'
HUSKY: 0
run: |
npm run build:package
npm run build:sanity
- name: Sync files to S3
run: |
aws s3 cp packages/sanity-suite/dist/ s3://${{ secrets.AWS_PROD_S3_BUCKET_NAME }}/sanity-suite --recursive --cache-control max-age=3600
AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/sanity-suite*"