diff --git a/README.md b/README.md index 2e85296..7abe746 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,16 @@ jobs: The `access_key_id` and `secret_access_key` are optional and if not provided the EC2 Metadata service will be queried for role based credentials. +## Params + +Parameters for setting up the `aws s3 sync` command include: + +``` +- put: push-to-s3 + params: + dir: subdirectory # will change the working directory to subdirectory before invoking the sync +``` + ## Options The `options` parameter is synonymous with the options that `aws cli` accepts for `sync`. Please see [S3 Sync Options](http://docs.aws.amazon.com/cli/latest/reference/s3/sync.html#options) and pay special attention to the [Use of Exclude and Include Filters](http://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters). diff --git a/assets/out b/assets/out index 242279a..1ca3455 100755 --- a/assets/out +++ b/assets/out @@ -19,6 +19,7 @@ payload=`cat` bucket=$(echo "$payload" | jq -r '.source.bucket') path=$(echo "$payload" | jq -r '.source.path // ""') options=$(echo "$payload" | jq -r '.source.options // [] | join(" ")') +dir=$(echo "$payload" | jq -r '.params.dir // "."') # export for `aws` cli AWS_ACCESS_KEY_ID=$(echo "$payload" | jq -r '.source.access_key_id // empty') @@ -34,8 +35,9 @@ fi # Export AWS_DEFAULT_REGION if set [ -n "$AWS_DEFAULT_REGION" ] && export AWS_DEFAULT_REGION -echo "Uploading to S3..." -eval aws s3 sync $source "s3://$bucket/$path" $options +cd "$source/$dir" +echo "Uploading to S3 from '$dir'..." +eval aws s3 sync $source/$dir "s3://$bucket/$path" $options echo "...done." source "$(dirname $0)/emit.sh" >&3