【问题标题】:Label Git repository in AppVeyor build using environment variable使用环境变量在 AppVeyor 构建中标记 Git 存储库
【发布时间】:2015-05-21 23:19:02
【问题描述】:

我正在尝试在 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 environment-variables yaml appveyor


    【解决方案1】:

    应该是:

    - git tag -a release/%APPVEYOR_BUILD_VERSION%
    - git push origin release/%APPVEYOR_BUILD_VERSION%
    

    【讨论】:

      猜你喜欢
      • 2016-02-17
      • 1970-01-01
      • 2016-01-27
      • 1970-01-01
      • 2014-11-26
      • 1970-01-01
      • 1970-01-01
      • 2020-09-29
      • 1970-01-01
      相关资源
      最近更新 更多