-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
52 lines (49 loc) · 2.1 KB
/
action.yml
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
name: Sync Salmon Directory
description: Syncs a directory to a bucket using rclone.
author: "deephaven"
inputs:
source:
required: true
type: string
description: "The source directory to sync."
destination:
required: true
type: string
description: "The destination directory to sync. Relative to the bucket. It is recommended to use the GitHub repo path (such as deephaven/salmon-sync) as the minimum base to prevent collisions."
aws-role:
required: true
type: string
description: "The AWS role to assume."
production:
required: false
default: "false"
type: boolean
description: "If true, the files will be deployed to the production site. Otherwise they will be deployed to the preview site."
temporary:
required: false
default: "true"
type: boolean
description: "If true, the files will be marked as temporary and deleted after 14 days. Otherwise they will persist in S3 indefinitely."
runs:
using: "composite"
steps:
- name: Setup rclone
uses: AnimMouse/setup-rclone@v1
with:
version: v1.68.1
- name: AWS OIDC Auth
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-2 # Docs are hosted in us-east-2
role-to-assume: ${{ inputs.aws-role }}
- name: Sync source to destination
shell: bash
env:
RCLONE_S3_PROVIDER: AWS
RCLONE_S3_REGION: us-east-2
RCLONE_S3_ENV_AUTH: true
RCLONE_S3_NO_CHECK_BUCKET: true # Don't try to create the bucket and fail if it doesn't exist
# Check temporary != 'false' so any other value is marked as temporary since there's no actual validation of boolean or required inputs
# The production bucket doesn't have a lifecycle rule, so omitting temporary just results in a tag on files. They won't actually be deleted
run: |
rclone sync --fast-list --checksum ${{ inputs.source }} :s3:${{ inputs.production == 'true' && 'deephaven-docs' || 'deephaven-docs-preview' }}/${{ inputs.destination }} ${{ inputs.temporary != 'false' && '--header-upload "x-amz-tagging: temporary=true"' || '' }}