-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add sync functionality #1
Open
jnumainville
wants to merge
14
commits into
deephaven:main
Choose a base branch
from
jnumainville:initial_action
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6f918a1
wip
jnumainville 07e7494
wip
jnumainville f599b85
wip
jnumainville 88242c6
wip
jnumainville 5d192e0
wip
jnumainville c8df4e9
wip
jnumainville 4900983
wip
jnumainville 3ebd26a
wip
jnumainville aa83319
wip
jnumainville 72cdbbb
wip
jnumainville 7ec26fe
wip
jnumainville df251ed
wip
jnumainville d7b7807
wip
jnumainville ab24e98
wip
jnumainville File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,43 @@ | ||
# salmon-sync | ||
|
||
This is a Github Action that syncs a folder to a Google Cloud bucket using `rclone`. | ||
This action is only meant to work for Deephaven's documentation. It could be used in a more general purpose way to sync a folder into any Google cloud bucket (with the proper credentials), but that is subject to change and may break in any version. | ||
|
||
## Parameters | ||
``` | ||
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.' | ||
project_number: | ||
required: true | ||
type: string | ||
description: 'The Google Cloud project number.' | ||
bucket: | ||
required: true | ||
type: string | ||
description: 'The Google Cloud bucket to sync to.' | ||
credentials: | ||
required: true | ||
type: string | ||
description: 'The Google Cloud credentials.' | ||
``` | ||
|
||
## Example | ||
The action can be used as a step in a workflow | ||
Here is an example that syncs from the local path `temp/blog` to the blog section of the bucket. | ||
``` | ||
- name: Sync to the blog | ||
uses: deephaven/salmon-sync@v1 | ||
with: | ||
source: temp/blog | ||
destination: deephaven/deephaven.io/blog | ||
project_number: ${{ secrets.DOCS_GOOGLE_CLOUD_PROJECT_NUMBER}} | ||
bucket: ${{ vars.DOCS_GOOGLE_CLOUD_BUCKET }} | ||
jnumainville marked this conversation as resolved.
Show resolved
Hide resolved
|
||
credentials: ${{ secrets.DOCS_GOOGLE_CLOUD_CREDENTIALS }} | ||
``` |
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,49 @@ | ||
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.' | ||
project_number: | ||
required: true | ||
type: string | ||
description: 'The Google Cloud project number.' | ||
bucket: | ||
required: true | ||
type: string | ||
description: 'The Google Cloud bucket to sync to.' | ||
credentials: | ||
jnumainville marked this conversation as resolved.
Show resolved
Hide resolved
|
||
required: true | ||
type: string | ||
description: 'The Google Cloud credentials.' | ||
|
||
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_PROJECT_NUMBER: ${{ inputs.project_number }} | ||
RCLONE_GCS_BUCKET_POLICY_ONLY: "true" | ||
run: rclone sync ${{ inputs.source }} gcs:${{ inputs.bucket }}/${{ inputs.destination }} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have anything to do with the URL we will generate? Or does it need to include the git repository as the prefix? I see the example has
deephaven/deephaven.io/blog
so I'm curious what the importance ofdeephaven/deephaven.io
is thereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure how the bucket is linked to the website, but this is just a location within the bucket.
deephaven/deephaven.io/blog
was just where Don wanted the blog content in this case.