You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: push-to-s3-and-invalidate-cloudfront/README.md
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Files are pushed to the S3 bucket depending on the user inputs supplied when the
6
6
Following examples describe how to use the action.
7
7
8
8
## Uploading to S3 based on user input
9
-
This example will **upload** the specified folder (`build-directory`) to a folder named `blog` on the S3 bucket(`myS3Bucket`). The action will not exclude any files while uploading them. The action will also invalidate the cloudfront cache. The action will attempt a max of `5` (based on `aws-retry-attempts` value) retries for any AWS operations before erroring out.
9
+
This example will **upload** the specified folder (`build-directory`) to a folder named `blog` on the S3 bucket(`myS3Bucket`). The action will not exclude any files while uploading them. The action will also invalidate the cloudfront cache. The action will attempt a max of `5` (based on `aws-retry-attempts` value) retries for any AWS operations before erroring out. This example will also delete files from S3 that do not exist in the source.
## Uploading/Deleting to/from S3 with minimal user unput
49
-
If this action is called when a `pull_request` is `opened` or `syncronized`, then the example will **upload** the specified folder (`build-directory`) to a folder named `pr-previews/PR-123` on the S3 bucket (`myS3Bucket`). The action will exclude any files that start with the default `pr-previews` prefix. The action will not invalidate the cloudfront cache.
50
+
If this action is called when a `pull_request` is `opened` or `syncronized`, then the example will **upload** the specified folder (`build-directory`) to a folder named `pr-previews/PR-123` on the S3 bucket (`myS3Bucket`). The action will exclude any files that start with the default `pr-previews` prefix. The action will not invalidate the cloudfront cache. This example will not delete files from S3 that do not exist in the source.
50
51
51
52
If this action is called when a `pull_request` is `closed`, then the example will **delete** the folder named `pr-previews/PR-123` on the S3 bucket (`myS3Bucket`).
52
53
The action will attempt a max of `2` (default) retries for any AWS operations before erroring out.
Copy file name to clipboardExpand all lines: push-to-s3-and-invalidate-cloudfront/action.yml
+25-5Lines changed: 25 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,12 @@ inputs:
56
56
Refer to https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-retries.html for the usage of retry retry attempts
57
57
required: false
58
58
default: "2"
59
+
s3-delete-stale-files:
60
+
description: |
61
+
A flag to indicate if the aws sync command should be run with the `--delete` flag. This will delete the files that exist in the destination but not in the source.
62
+
More information on this can be found at https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html
63
+
required: false
64
+
default: "false"
59
65
60
66
outputs:
61
67
dir_name:
@@ -64,6 +70,9 @@ outputs:
64
70
files_to_exlude:
65
71
description: Files to exclude from S3 when using the sync command.
66
72
value: ${{ steps.exclude.files_to_exclude }}
73
+
delete_stale_files:
74
+
description: Compute if the aws s3 sync command should run with the `--delete` flag based on user input.
75
+
value: ${{ steps.stale.delete_stale_files }}
67
76
68
77
runs:
69
78
using: composite
@@ -81,12 +90,12 @@ runs:
81
90
run: |
82
91
if [[ "${{ inputs.s3-directory }}" == "pr-previews" ]]
0 commit comments