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 操作导出环境变量,可以使用 export
关键字。导出变量的语法如下:
export variable_name=variable_value
例如,以下操作导出值为 MY_VARIABLE
的 my-value
环境变量:
steps: - export MY_VARIABLE=my-value
要使变量在 GitHub 操作外部可用,您可以使用 outputs
关键字。定义输出的语法如下:
outputs: variable_name: value: variable_value
例如,以下操作使用值 MY_VARIABLE
定义 my-value
输出:
outputs: MY_VARIABLE: value: my-value
在 GitHub actions 中导出变量的语法如下:
export variable_name=variable_value
以上是如何在github操作中导出变量的详细内容。更多信息请关注PHP中文网其他相关文章!