使用环境变量在 AppVeyor 构建中标记 Git 存储库
Label Git repository in AppVeyor build using environment variable
我正在尝试在 AppVeyor 中成功构建后标记存储库。我已阅读以下资源:
但我不知道如何在 AppVeyor 环境变量中替换。这是我正在使用的 Yaml:
on_success:
- git config --global credential.helper store
- ps: Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):x-oauth-basic@github.com`n"
- git tag -a release/$($env:APPVEYOR_BUILD_VERSION)
- git push origin release/$($env:APPVEYOR_BUILD_VERSION)
这会导致 AppVeyor 构建日志中出现以下错误
git config --global credential.helper store
Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):x-oauth-basic@github.com`n"
git tag -a release/$($env:APPVEYOR_BUILD_VERSION)
fatal: 'release/$($env:APPVEYOR_BUILD_VERSION)' is not a valid tag name.
Command exited with code 128
鉴于 powershell Add-Content 行应该按照示例工作,您应该如何将变量替换到 git 命令中?
应该是:
- git tag -a release/%APPVEYOR_BUILD_VERSION%
- git push origin release/%APPVEYOR_BUILD_VERSION%
我正在尝试在 AppVeyor 中成功构建后标记存储库。我已阅读以下资源:
但我不知道如何在 AppVeyor 环境变量中替换。这是我正在使用的 Yaml:
on_success:
- git config --global credential.helper store
- ps: Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):x-oauth-basic@github.com`n"
- git tag -a release/$($env:APPVEYOR_BUILD_VERSION)
- git push origin release/$($env:APPVEYOR_BUILD_VERSION)
这会导致 AppVeyor 构建日志中出现以下错误
git config --global credential.helper store
Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):x-oauth-basic@github.com`n"
git tag -a release/$($env:APPVEYOR_BUILD_VERSION)
fatal: 'release/$($env:APPVEYOR_BUILD_VERSION)' is not a valid tag name.
Command exited with code 128
鉴于 powershell Add-Content 行应该按照示例工作,您应该如何将变量替换到 git 命令中?
应该是:
- git tag -a release/%APPVEYOR_BUILD_VERSION%
- git push origin release/%APPVEYOR_BUILD_VERSION%