-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (63 loc) · 2.05 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
on:
push:
branches: ["main"]
permissions:
pull-requests: write
name: 🌱 Apply, Build, Deploy 🌿
jobs:
TF-Apply:
name: 🏗️ Apply Infra
runs-on: ubuntu-latest
steps:
- name: Check Out
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
terraform_version: 1.9.2
- name: Look around nd Init 👁️👁️
run: |
echo Looking around 👁️👁️
ls
cd terraform
echo Looking around 👁️👁️
ls
terraform init
- name: 🏗️ Terraform Apply
run: |
cd terraform
terraform apply -var="bucket-name=${{ secrets.S3_BUCKET }}" -var="db-name=${{ secrets.DB_NAME }}" -var="db-username=${{ secrets.DB_USER }}" -auto-approve
- run: echo ${{ steps.plan.outputs.stdout }}
- run: echo ${{ steps.plan.outputs.stderr }}
- run: echo ${{ steps.plan.outputs.exitcode }}
web-deploy:
name: 💫 Deploy
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
needs: ["TF-Apply"]
steps:
- name: Check Out
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-region: us-west-2
aws-access-key-id: ${{secrets.AWS_ACCESS_KEY_ID}}
aws-secret-access-key: ${{secrets.AWS_SECRET_ACCESS_KEY}}
- name: 😪 Installing Dependencies
run: |
cd web
npm install
- name: 🔨 Build Project
run: |
cd web
npm run build
- name: 🚀 Upload Package
run: |
aws s3 sync ./web/out s3://${{ secrets.S3_BUCKET }}/ --region us-west-2
aws s3 sync ./web/out s3://${{ secrets.S3_BUCKET }}-failover/ --region us-west-2