Skip to content

Commit 4f0c79c

Browse files
committed
Add S3 deploy workflow
1 parent 03ec0d9 commit 4f0c79c

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy to S3
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
10+
concurrency:
11+
group: deploy
12+
cancel-in-progress: true
13+
14+
jobs:
15+
deploy:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
cache: npm
24+
25+
- name: Install
26+
run: npm ci
27+
28+
- name: Build
29+
run: npm run build
30+
31+
- name: Configure AWS credentials
32+
uses: aws-actions/configure-aws-credentials@v4
33+
with:
34+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
35+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
36+
aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }}
37+
aws-region: eu-central-1
38+
39+
- name: Deploy to S3
40+
run: aws s3 sync dist s3://obra-react-s3-deploy --delete
41+
42+
# Optional: uncomment if you want a CloudFront cache invalidation
43+
# - name: Invalidate CloudFront
44+
# run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"

0 commit comments

Comments
 (0)