Label Git repository in AppVeyor build using environment variable
Asked Answered
O

1

5

I am trying to label a repository after a successful build in AppVeyor. I have read the following resources:

But I don't know how to substitute in an AppVeyor environment variable. Here is the Yaml that I am using:

on_success:
  - git config --global credential.helper store
  - ps: Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):[email protected]`n"
  - git tag -a release/$($env:APPVEYOR_BUILD_VERSION)
  - git push origin release/$($env:APPVEYOR_BUILD_VERSION)

This results in the following error in the AppVeyor build log

git config --global credential.helper store
Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):[email protected]`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

Given that the powershell Add-Content line is supposed to work as per the example how are you supposed to substitute variables into the git commands?

Organometallic answered 21/5, 2015 at 23:19 Comment(0)
C
7

Should be:

- git tag -a release/%APPVEYOR_BUILD_VERSION%
- git push origin release/%APPVEYOR_BUILD_VERSION%
Chickabiddy answered 22/5, 2015 at 5:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.