6
3

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 3 years have passed since last update.

GitHub Actionsでコマンドの結果を環境変数に設定する

Posted at

変数名=値 というテキストを $GITHUB_ENV にリダイレクトすると環境変数に設定でき、 ${{ env.変数名 }} でアクセスできる。

例: app_versionという環境変数に、package.jsonに記載されているバージョンを設定するには次のようにする。

      - name: setup environment variables
        run: |
          node -e "console.log('app_version=' + require('./package.json').version)" >> $GITHUB_ENV
      - name: use environment variable
        run: |
          echo "app_version is ${{ env.app_version }}"

参考

6
3
0

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
6
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?