Add arguments to configure the git username and email to the updater scripts
This commit is contained in:
parent
bb8e030aab
commit
7e97adc1c0
|
|
@ -5,6 +5,10 @@
|
||||||
Updates the build tools version and generates a commit message with the list of changes
|
Updates the build tools version and generates a commit message with the list of changes
|
||||||
.PARAMETER RepoRoot
|
.PARAMETER RepoRoot
|
||||||
The directory containing the repo
|
The directory containing the repo
|
||||||
|
.PARAMETER GitAuthorName
|
||||||
|
The author name to use in the commit message. (Optional)
|
||||||
|
.PARAMETER GitAuthorEmail
|
||||||
|
The author email to use in the commit message. (Optional)
|
||||||
.PARAMETER GitCommitArgs
|
.PARAMETER GitCommitArgs
|
||||||
Additional arguments to pass into git-commit
|
Additional arguments to pass into git-commit
|
||||||
.PARAMETER NoCommit
|
.PARAMETER NoCommit
|
||||||
|
|
@ -15,6 +19,8 @@
|
||||||
[cmdletbinding(SupportsShouldProcess = $true)]
|
[cmdletbinding(SupportsShouldProcess = $true)]
|
||||||
param(
|
param(
|
||||||
[string]$RepoRoot,
|
[string]$RepoRoot,
|
||||||
|
[string]$GitAuthorName = $null,
|
||||||
|
[string]$GitAuthorEmail = $null,
|
||||||
[string[]]$GitCommitArgs = @(),
|
[string[]]$GitCommitArgs = @(),
|
||||||
[switch]$NoCommit,
|
[switch]$NoCommit,
|
||||||
[switch]$Force
|
[switch]$Force
|
||||||
|
|
@ -76,7 +82,17 @@ try {
|
||||||
$message = "$shortMessage`n`n[auto-updated: buildtools]"
|
$message = "$shortMessage`n`n[auto-updated: buildtools]"
|
||||||
|
|
||||||
if (-not $NoCommit -and ($Force -or ($PSCmdlet.ShouldContinue($shortMessage, 'Create a new commit with these changes?')))) {
|
if (-not $NoCommit -and ($Force -or ($PSCmdlet.ShouldContinue($shortMessage, 'Create a new commit with these changes?')))) {
|
||||||
Invoke-Block { git commit -m $message @GitCommitArgs }
|
|
||||||
|
$gitConfigArgs = @()
|
||||||
|
if ($GitAuthorName) {
|
||||||
|
$gitConfigArgs += '-c',"user.name=$GitAuthorName"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($GitAuthorEmail) {
|
||||||
|
$gitConfigArgs += '-c',"user.email=$GitAuthorEmail"
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Block { git @gitConfigArgs commit -m $message @GitCommitArgs }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# If composing this script with others, return the message that would have been used
|
# If composing this script with others, return the message that would have been used
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@
|
||||||
The ID of the Lineup to determine which versions to use.
|
The ID of the Lineup to determine which versions to use.
|
||||||
.PARAMETER LineupVersion
|
.PARAMETER LineupVersion
|
||||||
The version of the Lineup to be used.
|
The version of the Lineup to be used.
|
||||||
|
.PARAMETER GitAuthorName
|
||||||
|
The author name to use in the commit message. (Optional)
|
||||||
|
.PARAMETER GitAuthorEmail
|
||||||
|
The author email to use in the commit message. (Optional)
|
||||||
.PARAMETER NoPush
|
.PARAMETER NoPush
|
||||||
Make commits without pusing.
|
Make commits without pusing.
|
||||||
#>
|
#>
|
||||||
|
|
@ -32,6 +36,15 @@ Import-Module "$PSScriptRoot/common.psm1" -Scope Local -Force
|
||||||
$RepoRoot = Resolve-Path "$PSScriptRoot\.."
|
$RepoRoot = Resolve-Path "$PSScriptRoot\.."
|
||||||
$ModuleDirectory = Join-Path $RepoRoot "modules"
|
$ModuleDirectory = Join-Path $RepoRoot "modules"
|
||||||
|
|
||||||
|
$gitConfigArgs = @()
|
||||||
|
if ($GitAuthorName) {
|
||||||
|
$gitConfigArgs += '-c',"user.name=$GitAuthorName"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($GitAuthorEmail) {
|
||||||
|
$gitConfigArgs += '-c',"user.email=$GitAuthorEmail"
|
||||||
|
}
|
||||||
|
|
||||||
Push-Location $ModuleDirectory
|
Push-Location $ModuleDirectory
|
||||||
try {
|
try {
|
||||||
# Init all submodules
|
# Init all submodules
|
||||||
|
|
@ -58,7 +71,7 @@ try {
|
||||||
Invoke-Block { & .\run.ps1 -Update upgrade deps --source $Source --id $LineupID --version $LineupVersion --deps-file $depsFile }
|
Invoke-Block { & .\run.ps1 -Update upgrade deps --source $Source --id $LineupID --version $LineupVersion --deps-file $depsFile }
|
||||||
Invoke-Block { & git add $depsFile }
|
Invoke-Block { & git add $depsFile }
|
||||||
|
|
||||||
Invoke-Block { & git commit --quiet -m "Update dependencies.props`n`n[auto-updated: dependencies]" @GitCommitArgs }
|
Invoke-Block { & git @gitConfigArgs commit --quiet -m "Update dependencies.props`n`n[auto-updated: dependencies]" @GitCommitArgs }
|
||||||
$sshUrl = "git@github.com:aspnet/$($submodule.module)"
|
$sshUrl = "git@github.com:aspnet/$($submodule.module)"
|
||||||
Invoke-Block { & git remote set-url --push origin $sshUrl }
|
Invoke-Block { & git remote set-url --push origin $sshUrl }
|
||||||
$updated_submodules += $submodule
|
$updated_submodules += $submodule
|
||||||
|
|
@ -84,7 +97,7 @@ try {
|
||||||
{
|
{
|
||||||
Push-Location $submodule.path
|
Push-Location $submodule.path
|
||||||
try {
|
try {
|
||||||
Invoke-Block { & git push origin $submodule.branch}
|
Invoke-Block { & git @gitConfigArgs push origin $submodule.branch}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,10 @@
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Updates git submodules and generates a commit message with the list of changes
|
Updates git submodules and generates a commit message with the list of changes
|
||||||
|
.PARAMETER GitAuthorName
|
||||||
|
The author name to use in the commit message. (Optional)
|
||||||
|
.PARAMETER GitAuthorEmail
|
||||||
|
The author email to use in the commit message. (Optional)
|
||||||
.PARAMETER GitCommitArgs
|
.PARAMETER GitCommitArgs
|
||||||
Additional arguments to pass into git-commit
|
Additional arguments to pass into git-commit
|
||||||
.PARAMETER NoCommit
|
.PARAMETER NoCommit
|
||||||
|
|
@ -98,7 +102,17 @@ try {
|
||||||
# add this to the commit message to make it possible to filter commit triggers based on message
|
# add this to the commit message to make it possible to filter commit triggers based on message
|
||||||
$message = "$shortMessage`n`n[auto-updated: submodules]"
|
$message = "$shortMessage`n`n[auto-updated: submodules]"
|
||||||
if (-not $NoCommit -and ($Force -or ($PSCmdlet.ShouldContinue($shortMessage, 'Create a new commit with these changes?')))) {
|
if (-not $NoCommit -and ($Force -or ($PSCmdlet.ShouldContinue($shortMessage, 'Create a new commit with these changes?')))) {
|
||||||
Invoke-Block { & git commit -m $message @GitCommitArgs }
|
|
||||||
|
$gitConfigArgs = @()
|
||||||
|
if ($GitAuthorName) {
|
||||||
|
$gitConfigArgs += '-c',"user.name=$GitAuthorName"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($GitAuthorEmail) {
|
||||||
|
$gitConfigArgs += '-c',"user.email=$GitAuthorEmail"
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Block { & git @gitConfigArgs commit -m $message @GitCommitArgs }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# If composing this script with others, return the message that would have been used
|
# If composing this script with others, return the message that would have been used
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue