How to use global environment variable to set project version?
Hi there,
We are trying to use the long-awaited global YAML feature.
we have a bunch of projects withing our suite for which the Major.Minor version should be kept the same.
Previously our code looked like so. These few lines are duplicated in most of our projects (but not all)
environment:
app_version: '10.0'
version: '$(app_version).{build}'
``
I have defined a variable int the global yaml called ospsuite_version
environment:
ospsuite_version: '10.0'
and I wanted to try to use this global version to set the build version
version: '$(ospsuite_version).{build}'
It does not seem to work as expected. The Variable is not available when the build is started and therefore, the version shown on appveyor is something lile
$(ospsuite_version).1-hhjrwxqu
Previously it would show 10.1.xxxxxx
I can see that this variable is available however as the script is executed because the components created have the right version (e.g. 10.0 in our case)
Is there a way for me to define a global variable and use it for the project version? Or is this not supported?
Thanks,
Take care,
Michael
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Feodor Fitsner on 22 Jun, 2020 04:41 PM
Hi Michael,
Indeed, global.yaml is getting injected after the information from project yaml was used to form a version string.
However, you can update build version from a script like this:
2 Posted by michael on 22 Jun, 2020 05:38 PM
Hi Feodor,
This almost works.
For PR, I'd like to get the version with the random characters
For example 10.0.1-xasdhasd
which is what {build} used to return
What is the equivalent ?
"$($env:ospsuite_version).$($env:appveyor_build_version)"
Does not work as it uses some other numbers
"$($env:ospsuite_version).$($env:appveyor_build)"
does not exist
Thanks for your help,
Michael
--
*Michael Sevestre*
*Design2Code Inc.*
Email [email blocked]
Website www.design2code.ca
Support Staff 3 Posted by Feodor Fitsner on 22 Jun, 2020 05:45 PM
You may set version as
version: {build}
and then use it to build a full version:4 Posted by michael on 22 Jun, 2020 05:50 PM
ah ah this works
Nice trick Feodor. Thank you!