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?
In Linux, you can set and unset user-specific environment variables. You must add and edit the “. bashrc” file in the home directory to export or change the environment variable. Then, to make the changes take effect, source the file.
Git always runs inside a bash shell, and uses a number of shell environment variables to determine how it behaves. Occasionally, it comes in handy to know what these are, and how they can be used to make Git behave the way you want it to.
appveyor. yml is a project configuration file in YAML format that should be placed in the root of your repository.
Should be:
- git tag -a release/%APPVEYOR_BUILD_VERSION%
- git push origin release/%APPVEYOR_BUILD_VERSION%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With