8
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GitHub ActionsとRcloneでGitHub管理されているファイルをGoogle Driveに同期する

Last updated at Posted at 2022-09-20

組織の中で、GitHubアカウントを持っていない人に対してGitHub管理されているファイルを共有したいなんてことがあるかもしれません。

今回は、GitHub ActionsとRcloneを利用して、GitHub管理されているファイルをGoogle Driveに同期したので手順をまとめます。

Rcloneについては以前に記事を書きましたのでこちらを御覧ください。
RcloneでmacOSとGoogle Driveのファイルを同期してみた - Qiita

1. Rcloneの設定ファイルを作成する

以前に書いた記事の初期設定として rclone config を実行しました。

初期設定が完了すると設定ファイル(~/.config/rclone/rclone.conf)が生成されるので内容を控えておきます。

2. GitHub ActionsのSecretsに登録する

以下の内容をGithub ActionsのSecretsに登録します。

名前: RCLONE_CONF
内容: 手順1で控えた設定ファイルの内容

スクリーンショット 2022-09-20 21.42.12.png

3. ワークフローを作成する

今回はマーケットプレイスに公開されているアクションを利用しました。

.github/workflows/sync-github-and-gdrive.yml
name: Sync GitHub and Google Drive
on: push
jobs:
  rclone:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: rclone
      uses: wei/rclone@v1
      env:
        RCLONE_CONF: ${{ secrets.RCLONE_CONF }}
      with:
        args: sync <source>:<source_path> <dest>:<dest_path>
        # 例
        # args: sync ./rclone_test google_drive:rclone_test

wei/rclone: Wraps the rclone CLI to be used in Github Actions

4. リポジトリにpushする

GitHub Actionsが実行され、Google Driveにファイルが同期されれば成功です。

以上です。

8
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?