File tree Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Deploy Static Site to S3
2+
3+ on :
4+ push :
5+ branches :
6+ - hugo
7+ workflow_dispatch :
8+
9+ permissions :
10+ contents : read
11+
12+ concurrency :
13+ group : " s3-deploy"
14+ cancel-in-progress : false
15+
16+ jobs :
17+ build-and-deploy :
18+ runs-on : ubuntu-latest
19+
20+ steps :
21+ - name : Checkout repository
22+ uses : actions/checkout@v4
23+
24+ - name : Setup Node.js
25+ uses : actions/setup-node@v3
26+ with :
27+ node-version : ' 24.x'
28+ cache : ' npm'
29+
30+ - name : Install dependencies
31+ run : npm ci
32+
33+ - name : Build site
34+ run : npm run build
35+
36+ - name : Fix permissions
37+ run : |
38+ chmod -c -R +rX "public/" | while read line; do
39+ echo "::warning title=Invalid file permissions automatically fixed::$line"
40+ done
41+
42+ - name : Upload site to S3
43+ uses : shallwefootball/s3-upload-action@master
44+ with :
45+ aws_key_id : ${{ secrets.AWS_KEY_ID }}
46+ aws_secret_access_key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
47+ aws_bucket : ${{ secrets.AWS_BUCKET }}
48+ source_dir : ' public'
49+ destination_dir : ' '
50+
51+ - name : Invalidate CloudFront cache
52+ uses : chetan/invalidate-cloudfront-action@master
53+ env :
54+ DISTRIBUTION : ${{ secrets.CLOUDFRONT_DISTRIBUTION }}
55+ PATHS : ' /*'
56+ AWS_REGION : ' eu-west-3'
57+ AWS_ACCESS_KEY_ID : ${{ secrets.AWS_KEY_ID }}
58+ AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
59+
60+ - name : Upload artifact (optional)
61+ uses : actions/upload-artifact@v3
62+ with :
63+ name : static-site
64+ path : public
You can’t perform that action at this time.
0 commit comments