-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reestructuring pipeline definitions to future-proof it.
- Loading branch information
Showing
3 changed files
with
82 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
#!/bin/bash | ||
|
||
define_variable () { | ||
echo "##vso[task.setvariable variable=$1;isOutput=true]$2" | ||
} | ||
|
||
echo "Source branch: $BUILD_SOURCEBRANCH" | ||
|
||
# If the build was triggered from a tag, use the tag as the version. Otherwise, set the version to dev. | ||
REGEX='^refs\/tags\/v?([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)(-.+)?' | ||
|
||
# If tag is a release tag, set up release variables. | ||
if [[ $BUILD_SOURCEBRANCH =~ $REGEX ]]; then | ||
echo "##vso[task.setvariable variable=ShouldCreateRelease]true" | ||
[[ $BUILD_SOURCEBRANCH =~ $REGEX ]] && define_variable "IsRelease" "true" || define_variable "IsRelease" "false" | ||
|
||
# Extract version from the tag. | ||
VERSION=$(echo $BUILD_SOURCEBRANCH | sed -r 's/'$REGEX'/\1.\2.\3\4/') | ||
# Extract version from the tag. | ||
VERSION=$([[ $BUILD_SOURCEBRANCH =~ $REGEX ]] && echo $(echo $BUILD_SOURCEBRANCH | sed -r 's/'$REGEX'/\1.\2.\3\4/') || echo "0.0.0-dev") | ||
|
||
# Set the AICLIVersion variable in the pipeline. | ||
echo "##vso[task.setvariable variable=AICLIVersion]$VERSION" | ||
# Set the AICLIVersion variable in the pipeline. | ||
define_variable "AICLIVersion" "$VERSION" | ||
|
||
# Set the AICLINuPkgFileName variable in the pipeline. | ||
echo "##vso[task.setvariable variable=AICLINuPkgFileName]Azure.AI.CLI.$VERSION.nupkg" | ||
else | ||
echo "##vso[task.setvariable variable=ShouldCreateRelease]false" | ||
fi | ||
# Set the AICLINuPkgFileName variable in the pipeline. | ||
define_variable "AICLINuPkgFileName" "Azure.AI.CLI.$VERSION.nupkg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters