So exportieren Sie Variablen in Github-Aktionen

Mary-Kate Olsen
Freigeben: 2024-10-10 11:41:14
Original
315 Leute haben es durchsucht

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

So exportieren Sie Variablen in Github-Aktionen

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>
Nach dem Login kopieren
Nach dem Login kopieren

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>
Nach dem Login kopieren

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>
Nach dem Login kopieren

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>
Nach dem Login kopieren

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>
Nach dem Login kopieren
Nach dem Login kopieren

Das obige ist der detaillierte Inhalt vonSo exportieren Sie Variablen in Github-Aktionen. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Neueste Artikel des Autors
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!