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?

1 Answer 1

7

Should be:

- git tag -a release/%APPVEYOR_BUILD_VERSION%
- git push origin release/%APPVEYOR_BUILD_VERSION%
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.