gactions の概要

gactions コマンドライン インターフェース(CLI)ツールを使用すると、必要なプロジェクト構造とファイルを作成し、Actions Console で Actions プロジェクトとしてデプロイできます。インストールとセットアップ後の一般的なシナリオでコマンドライン ツールを使用する方法については、代わりにユーザーガイドをご覧ください。

インストールすると、ターミナルでツールの機能の概要を確認できます。

gactions --help

次の出力が表示されます。

Command Line Interface for Google Actions SDK

Usage:
  gactions [command]

Available Commands:
  decrypt             Decrypt client secret.
  deploy              Deploy an Action to the specified channel.
  encrypt             Encrypt client secret.
  help                Help about any command
  init                Initialize a directory for a new project.
  login               Authenticate gactions CLI to your Google account via web browser.
  logout              Log gactions CLI out of your Google Account.
  pull                This command pulls files from Actions Console into the local file system.
  push                This command pushes changes in the local files to Actions Console.
  third-party-notices Prints license files of third-party software used.
  version             Prints current version of the CLI.

Flags:
  -h, --help      help for gactions
  -v, --verbose   Display additional error information

Use "gactions [command] --help" for more information about a command.

gactions コマンドライン ツールをインストールする

インストール パッケージをダウンロードして展開し、実行パスを構成して、gactions コマンドライン インターフェース(CLI)ツールをインストールします。

gactions をインストールして構成する手順は次のとおりです。

  1. ご使用のオペレーティング システムに対応したパッケージをダウンロードします。

    プラットフォーム パッケージ チェックサム
    ウィンドウ ダウンロード SHA256
    Linux ダウンロード SHA256
    Mac OS ダウンロード SHA256
  2. パッケージを任意の場所に抽出し、バイナリを環境の PATH 変数に追加します。または、PATH 変数にすでに含まれている場所(例: /usr/local/bin)にパッケージを解凍します。

  3. Linux と Mac で、必要に応じて実行権限を有効にします。

    chmod +x PATH_TO/gactions
  4. 次のコマンドを実行して CLI を認証します。このコマンドは認証フローを開始します。その際、ウェブブラウザが必要になります。

    gactions login

    フローが完了すると、CLI が自動的に認証されます。

プロジェクトを作成して設定する

gactions コマンドライン ツールを使用する前に、Actions Console でプロジェクトを作成し、gactions にプロジェクトへのアクセス権を付与する必要があります。プロジェクトを作成して設定する手順は次のとおりです。

  1. Actions Console に移動します。
  2. [新しいプロジェクト] をクリックし、プロジェクト名を入力して、[プロジェクトを作成] をクリックします。
  3. カテゴリを選択し、[次へ] をクリックします。
  4. [Blank project] を選択し、[Start building](ビルドを開始)をクリックします。
  5. API を有効または無効にする手順に沿って、Google Cloud コンソールで Actions API を有効にします。これにより、Gactions がプロジェクトを操作できるようになります。

サンプルを初期化する

空のディレクトリを作成し、そのディレクトリで gactions init SAMPLE_NAME を実行してサンプルの Actions プロジェクトをインポートします。サンプル プロジェクトをモデルとして使用して、独自のプロジェクトを作成し、Actions プロジェクトの構造を理解できます。

たとえば、次のコマンドを実行すると、hello-world サンプルの内容がディレクトリに追加されます。

gactions init hello-world