-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
62 lines (58 loc) · 1.95 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
53
54
55
56
57
58
59
60
61
62
name: Sync Salmon Directory
description: Syncs a directory to a Google Cloud 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."
bucket:
required: true
type: string
description: "The Google Cloud bucket to sync to."
credentials:
required: true
type: string
description: "The Google Cloud credentials. Should be base64 encoded."
cache-bust-token:
required: true
type: string
description: "The cache-bust token"
docs-url:
required: true
type: string
description: "The doc site URL"
runs:
using: "composite"
steps:
- name: Setup rclone
uses: AnimMouse/setup-rclone@v1
with:
version: v1.68.1
- name: Decode credentials
shell: bash
run: |
echo $RCLONE_GCS_SERVICE_ACCOUNT_CREDENTIALS_ENCODED | base64 --decode > $HOME/credentials.json
env:
RCLONE_GCS_SERVICE_ACCOUNT_CREDENTIALS_ENCODED: ${{ inputs.credentials }}
- name: Sync source to destination
shell: bash
env:
RCLONE_CONFIG_GCS_TYPE: "google cloud storage"
RCLONE_GCS_SERVICE_ACCOUNT_FILE: $HOME/credentials.json
RCLONE_GCS_BUCKET_POLICY_ONLY: "true"
run: rclone sync ${{ inputs.source }} gcs:${{ inputs.bucket }}/${{ inputs.destination }}
- name: Bust cache
shell: bash
env:
CACHE_BUST_TOKEN: ${{ inputs.cache-bust-token }}
run: |
curl --fail-with-body --show-error --silent \
--request POST \
--header "authorization: Bearer $CACHE_BUST_TOKEN" \
--data "{ \"tags\": [ \"${{ inputs.destination }}\" ]}" \
--url ${{ inputs.docs-url }}/api/cache-bust/