LoginSignup
31
11

More than 1 year has passed since last update.

GitHub ActionsでNode.js 12のサポートが終了します

Last updated at Posted at 2022-10-24

先に結論だけ

2022年9月22日から、GitHub ActionsでNode.js v12の非推奨化プロセスが始まりました。Node.js v12に依存するactions/checkout@v2, actions/setup-node@v2をv3に移行しましょう。

はじめに

この記事は、GitHub ActionsでのNode.js v12サポート終了と、その対処法を共有するためのものです。

対象とする読者

  • すでにGitHub Actionsを使っている

サポート終了の告知

いつも通りGitHubで作業をしていると、見慣れない警告がActionsタブに表示されていました。

build (14.x)
Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: actions/checkout, actions/setup-node, actions/setup-node, actions/checkout
Node.js 12 のアクションは非推奨です。詳しくは https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/ をご覧ください。 次のアクションを Node.js 16 を使用するように更新してください: actions/checkout, actions/setup-node

公式Blogでの告知

警告メッセージに表記されているBlog記事を参照します。

GitHub Actionsを実行している環境で、Node.js v12のサポートが終了するのでv16に移行するようにという告知がありました。

必要な対処

Blog記事を参考に、対処方法を確認します。

GitHub公式のactionsをv3に更新する

actions/checkout, actions/setup-nodeなど内部的にNode.js v12を使うアクションを最新バージョンに更新します。ワークフローがどのアクションに依存しているかは、GitHubのActionsタブ内のサマリーに表示されています。

v2と指定されているアクションをv3に更新します。

▼.github/workflows/あなたのワークフロー.yml

    steps:
      - uses: actions/checkout@v3
                              ^^^

actions/setup-node with node-version "16"

actions/setup-nodeで利用するNode.jsのバージョンを16以上に設定します。

▼.github/workflows/あなたのワークフロー.yml

      - name: Use Node.js
        uses: actions/setup-node@v3
        with:
          node-version: "16"
                        ^^^^

マトリックス戦略を使っている箇所も、Node.js v16以上に変更します。

▼.github/workflows/あなたのワークフロー.yml

  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [ 16.x, 18.x ]
                        ^^^^^^^^^^

以上、ありがとうございました。

31
11
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
31
11