如何在Github Action(.yml配置文件)中将全局环境变量(在文件顶部设置的)用作端口号?这可能吗?
我尝试过
env:
APP_PORT: 3306
......
services:
mysql:
....
ports:
- ${{ env.APP_PORT }}
答案 0 :(得分:0)
访问表达式中的环境变量需要使用env.
前缀(另请参见https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#env-context):
env:
APP_PORT: 3306
......
services:
mysql:
....
ports:
- ${{ env.APP_PORT }}