GitHub Actionsは、GitHubが提供するCI/CDサービスである。

GitHub Actions
開発元 GitHub
種別 継続的インティグレーション/継続的デリバリー
公式サイト

(日)github.co.jp/features/actions (英)

github.com/features/actions
テンプレートを表示

GitHubと高度に統合されており、GitHubに公開されたコードを自動でビルド・テスト・デプロイを行うのが主目的である。

要素 編集

GitHub Actionsは複数の要素から構成される。

Step 編集

GitHub Actionsにおける stepjobを構成する1要素である[1]。実体は次のいずれかである[2]

  • シェルスクリプト
  • action

Action 編集

GitHub Actionsにおける actionstepとして利用可能なプログラムである。実体は以下のいずれかである[3]

  • Docker container
  • JavaScript
  • Composite Actions: 他actionの集まり

例えばJavaScript actionsであれば設定ファイルで実行Node.js環境を指定した上で、所定のJavaScriptファイルが自動実行される。Node.jsのバージョンはメタデータの runs.using を用いて指定され、2023-02現在、node12node16 の2種類が指定できる[4]node12 は廃止予定)。

設定 編集

リポジトリの .github/workws以下にYAML形式の設定ファイルを記述することで設定を行う。

設定はワークフローとアクションという単位で行われる。

ワークフロー 編集

設定ファイルの基本単位。イベントが起きたときに実行する処理を記述しておく。

アクション 編集

再利用可能な設定ファイルの単位。アクションだけを定義したリポジトリを読み込むことで複数のリポジトリから利用したり、ワークフローの存在するリポジトリに置くことでそのリポジトリにある複数のワークフローから利用することができる。

GitHubから公式でRubyGo言語などの環境構築をするためのアクションが用意されている[5]

脚注 編集

  1. ^ "A job is a set of steps in a workflow that execute on the same runner." GitHub. Understanding GitHub Actions. 2023-02-18閲覧.
  2. ^ "Each step is either a shell script that will be executed, or an action that will be run." GitHub. Understanding GitHub Actions. 2023-02-18閲覧.
  3. ^ "You can build Docker container, JavaScript, and composite actions." GitHub. Understanding GitHub Actions. 2023-02-18閲覧.
  4. ^ "runs.using for JavaScript actions" GitHub. Metadata syntax for GitHub Actions. 2023-02-18閲覧.
  5. ^ GitHub Actions” (英語). GitHub. 2020年5月21日閲覧。

外部リンク 編集