ホームページ  >  記事  >  開発ツール  >  Githubアクションで変数をエクスポートする方法

Githubアクションで変数をエクスポートする方法

Mary-Kate Olsen
Mary-Kate Olsenオリジナル
2024-10-10 11:41:14322ブラウズ

This article provides a comprehensive guide on managing environment variables within GitHub actions. It discusses two methods: exporting variables using the "export" keyword and defining outputs using the "outputs" keyword. The gu

Githubアクションで変数をエクスポートする方法

How to export an environment variable from a GitHub action?

To export an environment variable from a GitHub action, you can use the export keyword. The syntax for exporting a variable is as follows:

<code class="yaml">export variable_name=variable_value</code>

For example, the following action exports the MY_VARIABLE environment variable with the value my-value:

<code class="yaml">steps:
  - export MY_VARIABLE=my-value</code>

How can I make a variable available outside of a GitHub action?

To make a variable available outside of a GitHub action, you can use the outputs keyword. The syntax for defining outputs is as follows:

<code class="yaml">outputs:
  variable_name:
    value: variable_value</code>

For example, the following action defines the MY_VARIABLE output with the value my-value:

<code class="yaml">outputs:
  MY_VARIABLE:
    value: my-value</code>

What is the syntax for exporting a variable in GitHub actions?

The syntax for exporting a variable in GitHub actions is as follows:

<code class="yaml">export variable_name=variable_value</code>

以上がGithubアクションで変数をエクスポートする方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。