The s3_sync
GitHub action will synchronize a local directory to an AWS S3 bucket. Recursively copies new and updated files from the source directory to the destination. Only creates folders in the destination if they contain one or more files.
Note: The sync action works on directories only, not individual files, and can be configured to remove files that exist in the destination bucket but not in the source directory during sync.
- uses: clowdhaus/aws-github-actions/s3_sync@main
with:
# Path to local directory to synchronize, starting from project root directory
# Required: true
local-path: ''
# S3 bucket name - excluding any ARN syntax or prefix path, just the bucket name
# Required: true
bucket-name: ''
# Prefix path that will be appended to bucket name, where contents will be synchronized to.
# Default: ''
path-prefix: ''
# Arguments that can be passed to the awscli commands for S3 sync
# The sync command is not exposed in the javascript sdk and therefore this GitHub action
# is simply a wrapper for the awscli `aws s3 sync $@` command. For more details on arguments
# see the documentation at https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html
# Default: ''
args: ''
- uses: clowdhaus/aws-github-actions/s3_sync@main
with:
local-path: dist/
bucket-name: my-s3-bucket
- uses: clowdhaus/aws-github-actions/s3_sync@main
with:
local-path: dist/
bucket-name: my-s3-bucket
path-prefix: src/
- uses: clowdhaus/aws-github-actions/s3_sync@main
with:
local-path: dist/
bucket-name: my-s3-bucket
path-prefix: src/
args: --delete
Only syncs *.js
files in dist/
directory and delete those no longer found from src/
Note: order of args dictates precedence - see documentation
- uses: clowdhaus/aws-github-actions/s3_sync@main
with:
local-path: dist/
bucket-name: my-s3-bucket
path-prefix: src/
args: --exclude "*" --include "*.js" --delete