Skip to content

Merge pull request #25 from NYPL-discovery/tgr-main #7

Merge pull request #25 from NYPL-discovery/tgr-main

Merge pull request #25 from NYPL-discovery/tgr-main #7

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-file: '.nvmrc'
- name: npm install
run: npm ci
- name: Unit Tests
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
- uses: hashicorp/setup-terraform@v2
- name: npm install
run: npm ci
- 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
- uses: hashicorp/setup-terraform@v2
- name: npm install
run: npm ci
- name: Deploy app to Production
run: |
terraform -chdir=provisioning/production init -input=false
terraform -chdir=provisioning/production apply -auto-approve -input=false