Skip to content

Merge pull request #101 from NYPL/main #273

Merge pull request #101 from NYPL/main

Merge pull request #101 from NYPL/main #273

name: Test and deploy
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'npm'
- name: Install dependencies
run: npm i
- name: Run linter and test suite
run: npm test
deploy-qa:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/qa'
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: arn:aws:iam::946183545209:role/GithubActionsDeployerRole
aws-region: us-east-1
- uses: actions/checkout@v3
- name: Install dependencies
run: npm i
- uses: hashicorp/setup-terraform@v2
- name: Deploy app to QA
run: |
terraform -chdir=provisioning/qa init -input=false
terraform -chdir=provisioning/qa apply -auto-approve -input=false
deploy-production:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/production'
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: arn:aws:iam::946183545209:role/GithubActionsDeployerRole
aws-region: us-east-1
- uses: actions/checkout@v3
- name: Install dependencies
run: npm i
- uses: hashicorp/setup-terraform@v2
- name: Deploy app to production
run: |
terraform -chdir=provisioning/production init -input=false
terraform -chdir=provisioning/production apply -auto-approve -input=false