Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for environment variables for default values for MinVer settings #8

Merged
merged 1 commit into from
Nov 27, 2020

Conversation

augustoproiete
Copy link
Member

This PR adds the ability to use environment variables to set default variables to Cake.MinVer settings. The environment variable is only used for settings that have not been explicitly set in the MinVerSettings in the Cake build script.

Environment variables that translate to MinVer arguments

Environment Variable MinVerSettings
MINVERAUTOINCREMENT ➡️ AutoIncrement
MINVERBUILDMETADATA ➡️ BuildMetadata
MINVERDEFAULTPRERELEASEPHASE ➡️ DefaultPreReleasePhase
MINVERMINIMUMMAJORMINOR ➡️ MinimumMajorMinor
MINVERTAGPREFIX ➡️ TagPrefix
MINVERVERBOSITY ➡️ Verbosity

Environment variables that change Cake.MinVer behavior

Environment Variable MinVerSettings
MINVERPREFERGLOBALTOOL ➡️ PreferGlobalTool
MINVERNOFALLBACK ➡️ NoFallback
MINVERTOOLPATH ➡️ ToolPath

e.g.

Given the following environment variables have been set:

Environment Variable Value
MINVERBUILDMETADATA abcd
MINVERDEFAULTPRERELEASEPHASE beta

And the Cake script executes:

var buildVersion = MinVer(s => s.WithDefaultPreReleasePhase("preview"));
Information($"Version: {buildVersion.Version}"); // e.g. 1.2.3-preview.0.1+abcd

Will have the same outcome as:

var buildVersion = MinVer(s => s.WithDefaultPreReleasePhase("preview").WithBuildMetadata("abcd"));
Information($"Version: {buildVersion.Version}"); // e.g. 1.2.3-preview.0.1+abcd

The MINVERBUILDMETADATA environment variable is used to automatically set the BuildMetadata setting, and the MINVERDEFAULTPRERELEASEPHASE environment variable is ignored because DefaultPreReleasePhase set explicitly.

@augustoproiete augustoproiete added the enhancement New feature or request label Nov 27, 2020
@augustoproiete augustoproiete added this to the 0.2.0 milestone Nov 27, 2020
@augustoproiete augustoproiete merged commit 4145340 into master Nov 27, 2020
@augustoproiete augustoproiete deleted the support-env-variables branch November 27, 2020 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant