File tree Expand file tree Collapse file tree 1 file changed +74
-0
lines changed Expand file tree Collapse file tree 1 file changed +74
-0
lines changed Original file line number Diff line number Diff line change 1+ name : S3 Deployment
2+
3+ on :
4+ workflow_call :
5+ inputs :
6+ aws-region :
7+ description : " AWS region"
8+ type : string
9+ required : false
10+ default : " ap-southeast-2"
11+ s3-bucket :
12+ description : " Name of the S3 bucket"
13+ type : string
14+ required : true
15+ s3-path :
16+ description : " Path in the S3 bucket"
17+ type : string
18+ required : false
19+ default : " "
20+ local-path :
21+ description : " Path to deploy"
22+ type : string
23+ required : true
24+ default : " "
25+ delete-flag :
26+ description : " Enable --delete flag"
27+ type : boolean
28+ required : false
29+ default : true
30+ cache-control :
31+ description : " Cache control headers"
32+ type : string
33+ required : false
34+ extra-args :
35+ description : " Additional AWS CLI args"
36+ type : string
37+ required : false
38+ default : " "
39+
40+ jobs :
41+ deploy :
42+ runs-on : ubuntu-latest
43+ steps :
44+ - name : Checkout
45+ uses : actions/checkout@v4
46+
47+ - name : Configure AWS creds
48+ uses : aws-actions/configure-aws-credentials@latest
49+ with :
50+ aws-access-key-id : ${{ secrets.aws-access-key-id }}
51+ aws-secret-access-key : ${{ secrets.aws-secret-access-key }}
52+ aws-region : ${{ inputs.aws-region }}
53+
54+ - name : Deploy to S3
55+ run : |
56+ s3_path=""
57+ cache_control=""
58+ extra_args=""
59+
60+ if [ -n "${{inputs.cache-control}}" ]; then
61+ cache_control="--cache-control \"${{inputs.cache-control}}\""
62+ fi
63+
64+ command="aws s3 sync ${{inputs.local-path}} s3://${{inputs.s3-bucket}}${{inputs.s3-path}} ${cache_control} ${{inputs.extra-args}}"
65+
66+ if [ "${{inputs.delete-flag}}" = "true" ]; then
67+ command="$command --delete"
68+ fi
69+
70+ $command
71+
72+
73+
74+
You can’t perform that action at this time.
0 commit comments