-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (39 loc) · 1.15 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Name of workflow as seen in Github actions tab
name: BuildAndUploadToS3
# Run workflow only on push to dev branch
on:
push:
branches:
- main
env:
BUCKET_NAME : "crislombardo.com"
AWS_REGION : "us-east-1"
jobs:
# To build the project
BuildAndUploadToS3:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checking out code
uses: actions/checkout@v3
- name: Installing Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Installing dependencies
run: npm install
- name: Building project
env:
VITE_API_KEY: ${{ secrets.EMAIL_API_KEY }}
VITE_EMAIL_ENDPOINT: ${{ secrets.EMAIL_ENDPOINT }}
run: npm run build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::890078463828:role/ghActionUploadS3
role-session-name: GhActionSession
aws-region: ${{ env.AWS_REGION }}
- name: Deploy to S3 bucket
run: aws s3 sync ./build/ s3://${{ env.BUCKET_NAME }} --delete