Skip to content

Commit

Permalink
terraform with github action
Browse files Browse the repository at this point in the history
  • Loading branch information
Junitalama committed Mar 2, 2024
1 parent a0b945f commit c901a00
Showing 1 changed file with 24 additions and 29 deletions.
53 changes: 24 additions & 29 deletions .github/workflows/frontend-s3-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
name: 'Terraform'
name: S3 Deployment

on:
push:
branches:
- main

jobs:
terraform:
name: 'Terraform'
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Terraform
uses: hashicorp/setup-terraform@v1

- name: Terraform Initialize
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: terraform init
defaults:
run:
working-directory: ./frontend/farm_volunteers

- name: Terraform Validate
run: terraform validate

- name: Terraform Plan
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: terraform plan

- name: Terraform Apply
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: terraform apply -auto-approve
steps:
- name: Checkout Repository
uses: actions/[email protected]

- name: Configure AWS Credentials
uses: aws-actions/[email protected]
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: Build application
run: |
npm install
npm run build
- name: Sync build folder to S3
run: |
aws s3 sync build/ s3://farmcity

0 comments on commit c901a00

Please sign in to comment.