2023-08-30 16:40:48 +02:00
|
|
|
name: 🚀 Deploy to AWS
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
tags:
|
|
|
|
- '*'
|
|
|
|
paths:
|
|
|
|
- api/**
|
|
|
|
- serverless.yml
|
|
|
|
- package.json
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
deploy-api:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup Node.js
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 16
|
|
|
|
|
|
|
|
- name: Install Serverless CLI and dependencies
|
|
|
|
run: |
|
2023-08-30 16:46:34 +02:00
|
|
|
npm i -g serverless
|
2023-08-30 16:40:48 +02:00
|
|
|
yarn
|
|
|
|
- name: Deploy to AWS
|
|
|
|
env:
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
run: serverless deploy
|
|
|
|
|
2023-08-30 19:01:33 +02:00
|
|
|
|
|
|
|
deploy-frontend:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup Node.js
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 16
|
|
|
|
|
|
|
|
- name: Install dependencies and build
|
|
|
|
run: |
|
|
|
|
yarn install
|
|
|
|
yarn build
|
|
|
|
|
|
|
|
- name: Upload to S3
|
2023-08-30 20:42:21 +02:00
|
|
|
uses: shallwefootball/s3-upload-action@master
|
|
|
|
id: S3
|
2023-08-30 19:01:33 +02:00
|
|
|
with:
|
2023-08-30 20:42:21 +02:00
|
|
|
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
|
|
|
|
aws_bucket: 'web-check-frontend'
|
|
|
|
source_dir: ''
|
2023-08-30 19:01:33 +02:00
|
|
|
|
|
|
|
- name: Invalidate CloudFront cache
|
2023-08-30 19:11:53 +02:00
|
|
|
uses: chetan/invalidate-cloudfront-action@v2.4
|
2023-08-30 19:01:33 +02:00
|
|
|
env:
|
|
|
|
DISTRIBUTION: E30XKAM2TG9FD8
|
|
|
|
PATHS: '/*'
|
|
|
|
AWS_REGION: 'us-east-1'
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|