[英]Github Action use environment variable as port
How can I use the global environment variable (that I set at the top of the file) as my port number in Github Action (.yml config file)?如何在 Github Action(.yml 配置文件)中使用全局环境变量(我在文件顶部设置的)作为我的端口号? Is this possible?这可能吗?
I have tried我试过了
env:
APP_PORT: 3306
......
services:
mysql:
....
ports:
- ${{ env.APP_PORT }}
What you are trying to do is not possible, as services are defined below a job and not below a step:您尝试做的事情是不可能的,因为服务是在作业下方而不是在步骤下方定义的:
You can use the
env
context in the value of any key in a step except for the id and uses keys.您可以在步骤中的任何键的值中使用env
上下文,除了 id 和使用键。
source: https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#env-context )来源: https : //docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#env-context )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.