-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (50 loc) · 1.55 KB
/
s3-upload.yml
File metadata and controls
54 lines (50 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: S3 Upload
on:
workflow_call:
inputs:
s3_bucket_name:
description: 'S3 bucket name to upload to'
required: true
type: string
deployer_role_arn:
description: 'IAM role ARN to assume for S3 deployment'
required: true
type: string
aws_region:
description: 'AWS region'
required: false
default: 'us-east-1'
type: string
source_path:
description: 'Source path to upload (defaults to repository root)'
required: false
default: '.'
type: string
delete:
description: 'Delete files in S3 that are not in the source'
required: false
default: true
type: boolean
permissions:
id-token: write # Required for requesting the JWT
contents: read # Required for actions/checkout
jobs:
upload:
name: Upload to S3
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ inputs.deployer_role_arn }}
role-session-name: github_federated_aws
aws-region: ${{ inputs.aws_region }}
- name: Upload to S3
run: |
if [ "${{ inputs.delete }}" = "true" ]; then
aws s3 sync ${{ inputs.source_path }} s3://${{ inputs.s3_bucket_name }} --delete --sse AES256
else
aws s3 sync ${{ inputs.source_path }} s3://${{ inputs.s3_bucket_name }} --sse AES256
fi