-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b302b3
commit 54133b7
Showing
3 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: 'Sync files to S3' | ||
description: 'Sync files to S3 and invalidate CloudFront' | ||
|
||
inputs: | ||
source: | ||
description: 'Path to the folder to sync.' | ||
required: true | ||
|
||
bucket: | ||
description: 'Name of the S3 bucket to sync to.' | ||
required: true | ||
|
||
delete: | ||
description: 'Delete files that exist in the destination but not in the source during sync.' | ||
required: false | ||
|
||
distribution-id: | ||
description: 'The CloudFront distribution id. If provided, the distribution will be invalidated after the sync.' | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: 'Sync files' | ||
shell: bash | ||
run: | | ||
aws s3 sync "${{ inputs.source }}" \ | ||
"s3://${{ inputs.bucket }}" \ | ||
${{ inputs.delete && '--delete' }} | ||
- name: 'Invalidate CloudFront' | ||
if: inputs.distribution-id != '' | ||
shell: bash | ||
run: | | ||
aws cloudfront create-invalidation \ | ||
--distribution-id ${{ inputs.distribution-id }} \ | ||
--paths "/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: 'Setup AWS CLI' | ||
|
||
description: 'Install and configure the AWS CLI' | ||
|
||
inputs: | ||
region: | ||
description: 'The default region' | ||
required: true | ||
|
||
access-key-id: | ||
description: 'The access key id' | ||
required: true | ||
|
||
secret-access-key: | ||
description: 'The secret access key' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: 'Install aws cli' | ||
shell: bash | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y awscli | ||
- name: 'Configure aws cli' | ||
shell: bash | ||
run: | | ||
aws configure set default.region ${{ inputs.region }} | ||
aws configure set aws_access_key_id ${{ inputs.access-key-id }} | ||
aws configure set aws_secret_access_key ${{ inputs.secret-access-key }} |