Skip to content

Commit

Permalink
Merge pull request #1996 from twangboy/add_version_win
Browse files Browse the repository at this point in the history
Add script version to powershell script
  • Loading branch information
twangboy authored Apr 12, 2024
2 parents 4987f08 + e55bccd commit 1d1ef48
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/workflows/scripts/cut-release.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def main():
+ changelog_file.read_text()
)

# Update Script Version for the bash script
bootstrap_script_path = REPO_ROOT / "bootstrap-salt.sh"
print(
f"* Updating {bootstrap_script_path.relative_to(REPO_ROOT)} ...",
Expand All @@ -201,6 +202,22 @@ def main():
bootstrap_script_path.read_text(),
)
)

# Update the Script Version for the powershell script
bootstrap_script_path = REPO_ROOT / "bootstrap-salt.ps1"
print(
f"* Updating {bootstrap_script_path.relative_to(REPO_ROOT)} ...",
file=sys.stderr,
flush=True,
)
bootstrap_script_path.write_text(
re.sub(
r'\$__ScriptVersion = "(.*)"',
f'$__ScriptVersion = "{options.release_tag.lstrip("v")}"',
bootstrap_script_path.read_text(),
)
)

parser.exit(status=0, message="CHANGELOG.md and bootstrap-salt.sh updated\n")


Expand Down
18 changes: 17 additions & 1 deletion bootstrap-salt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ param(
[Parameter(Mandatory=$false)]
[Alias("h")]
# Displays help for this script.
[Switch] $Help
[Switch] $Help,

[Parameter(Mandatory=$false)]
[Alias("e")]
# Displays the Version for this script.
[Switch] $ScriptVersion
)

# We'll check for help first because it really has no requirements
Expand All @@ -105,6 +110,15 @@ if ($help) {
exit 0
}

$__ScriptVersion = "2024.04.03"
$ScriptName = $myInvocation.MyCommand.Name

# We'll check for the Version next, because it also has no requirements
if ($ScriptVersion) {
Write-Host $__ScriptVersion
exit 0
}

#===============================================================================
# Script Preferences
#===============================================================================
Expand Down Expand Up @@ -303,6 +317,8 @@ if ( [Uri]($RepoUrl).AbsoluteUri -eq $defaultUrl ) {
#===============================================================================
# Verify Parameters
#===============================================================================
Write-Verbose "Running Script: $ScriptName"
Write-Verbose "Script Version: $__ScriptVersion"
Write-Verbose "Parameters passed in:"
Write-Verbose "version: $Version"
Write-Verbose "runservice: $RunService"
Expand Down

0 comments on commit 1d1ef48

Please sign in to comment.