Skip to content

Instantly share code, notes, and snippets.

@Kimserey
Last active April 1, 2018 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kimserey/676f32bcfba5b48549b0c841fd57ee60 to your computer and use it in GitHub Desktop.
Save Kimserey/676f32bcfba5b48549b0c841fd57ee60 to your computer and use it in GitHub Desktop.
Use Gitversion to find version of current branch, commit and tag to prepare for release
# Get the version from master branch by running gitversion.
# Make sure Gitversion is registered in PATH!
$version = gitversion /showvariable semver
# Update Directory.build.props version <version></version>.
# It dictates all *.dll versions.
$propsPath = "$pwd\Directory.build.props"
[xml]$props = Get-Content $propsPath
$props.Project.PropertyGroup.Version = "$version"
$props.Save("$propsPath")
# Commit bump version and tag commit.
# Then push the newly tagged commit to origin.
git add $propsPath
git commit -m "Bump version for release"
git tag $version
git push --porcelain
git push --tags --porcelain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment