Merge pull request #114 from rtjord/dev #16
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: Deploy Backend to Production Environment | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
deploy-prod: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Sam CLI | |
uses: aws-actions/setup-sam@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: Cache Node.js modules | |
uses: actions/cache@v3 | |
with: | |
path: backend/node_modules | |
key: ${{ runner.os }}-backend-node-${{ hashFiles('backend/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-backend-node- | |
- name: Install dependencies | |
working-directory: backend | |
run: npm install | |
- name: Build | |
working-directory: backend | |
run: npm run build:linux | |
- name: Configure AWS Credentials for Production Account | |
uses: aws-actions/[email protected] | |
with: | |
role-to-assume: arn:aws:iam::864899856155:role/GitHubDeployRole | |
aws-region: us-east-2 | |
- name: Deploy to Production | |
working-directory: backend | |
run: sam deploy --no-confirm-changeset --no-fail-on-empty-changeset --parameter-overrides Stage=prod |