chore: update workflow to trigger on main branch #15
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: Frontend Deployment | |
on: | |
push: | |
branches: | |
- actions | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js for frontend | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
- name: Install frontend dependencies | |
run: npm install | |
- name: Build frontend | |
run: npm run build | |
- name: Set up Node.js for CDK | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
- name: Install CDK dependencies | |
working-directory: ./PRO04-cdk | |
run: npm install aws-cdk-lib | |
- name: Install project dependencies in PRO04-cdk | |
working-directory: ./PRO04-cdk | |
run: npm install | |
- 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: eu-west-2 | |
- name: Synthesize CDK stack | |
working-directory: ./PRO04-cdk | |
run: npx cdk synth | |
- name: Deploy with CDK | |
working-directory: ./PRO04-cdk | |
run: | | |
npx cdk synth | |
npx cdk deploy --require-approval never | |
env: | |
CDK_DEFAULT_ACCOUNT: ${{ secrets.AWS_ACCOUNT_ID }} | |
CDK_DEFAULT_REGION: eu-west-2 | |