Skip to content

Commit b809225

Browse files
committed
Create github workflow to deploy frontend to S3
* Ensure that action triggers only on push to main and on any changes to frontend directory * Uploads contents in dist folder to s3 bucket
1 parent 1ffbe7d commit b809225

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/frontend.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Deploy Frontend
2+
3+
on:
4+
push:
5+
branches: [ 'main' ]
6+
7+
workflow_dispatch:
8+
9+
permissions:
10+
id-token: write # This is required for requesting the JWT
11+
contents: read # This is required for actions/checkout
12+
13+
env:
14+
AWS_REGION: ap-southeast-1
15+
S3_BUCKET_NAME: app.peerprep.org
16+
17+
jobs:
18+
deploy:
19+
name: Deploy Frontend
20+
runs-on: ubuntu-latest
21+
environment: production
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Configure AWS credentials
27+
id: aws-configure
28+
uses: aws-actions/[email protected]
29+
with:
30+
role-to-assume: arn:aws:iam::491085383176:role/github_s3_copy
31+
role-session-name: GitHub_to_AWS_via_FederatedOIDC
32+
aws-region: ${{ env.AWS_REGION }}
33+
34+
- name: Build frontend distribution
35+
working-directory: frontend
36+
run: npm ci && npm run build
37+
38+
- name: Sync distribution to S3
39+
run: |
40+
aws s3 sync ./frontend/dist/frontend/browser/ s3://$S3_BUCKET_NAME --delete

0 commit comments

Comments
 (0)