Manual Deploy Staging AWS #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Manual Deploy Staging AWS | |
env: | |
NODE_VERSION: "16" | |
on: | |
workflow_dispatch: | |
inputs: | |
use_staging_db: | |
description: "Deploy with staging db" | |
required: true | |
default: "false" | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
- run: npm ci | |
- run: npm run lint --if-present | |
test: | |
name: Unit Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
- run: npm ci | |
- run: npm test --if-present | |
typeCheck: | |
name: Type Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
- run: npm ci | |
- run: npm run typeCheck --if-present | |
deploy: | |
needs: [lint, typeCheck, test] | |
name: Upload to Amazon S3 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-west-2 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
- run: npm ci | |
- name: Staging Database | |
if: ${{ github.event.inputs.use_staging_db == 'true' }} | |
run: npm run staging-db-build | |
- name: Production Database | |
if: ${{ github.event.inputs.use_staging_db == 'false' }} | |
run: npm run build | |
- name: Copy files to staging bucket | |
run: aws s3 sync ./dist/ s3://staging.cfe.allencell.org --delete |