Skip to content

Commit

Permalink
updating task to delay for git pull to see the new tag
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelcolas committed Mar 10, 2021
1 parent 05ccc27 commit cf0465f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
19 changes: 14 additions & 5 deletions .build/tasks/New-Release.GitHub.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ task Publish_release_to_GitHub -if ($GitHubToken -and (Get-Module -Name PowerShe
}

Write-Build Green "Follow the link -> $($APIResponse.html_url)"
Start-Sleep -Seconds 5 # Making a pause to make sure the tag will be available at next Git Pull
}
else
{
Expand Down Expand Up @@ -178,9 +179,17 @@ task Create_ChangeLog_GitHub_PR -if ($GitHubToken -and (Get-Module -Name PowerSh
}
}

git @('pull', 'origin', $MainGitBranch, '--tag')
&git @('config', 'user.name', $GitHubConfigUserName)
&git @('config', 'user.email', $GitHubConfigUserEmail)
&git @('config', 'pull.rebase', 'true')
&git @('pull', 'origin', $MainGitBranch, '--tag')
# Look at the tags on latest commit for origin/$MainGitBranch (assume we're on detached head)
$TagsAtCurrentPoint = git @('tag', '-l', '--points-at', (git @('rev-parse', "origin/$MainGitBranch")))
Write-Build DarkGray "git rev-parse origin/$MainGitBranch"
$MainHeadCommit = (git @('rev-parse', "origin/$MainGitBranch"))
Write-Build DarkGray "git tag -l --points-at $MainHeadCommit"
$TagsAtCurrentPoint = git @('tag', '-l', '--points-at', $MainHeadCommit)
Write-Build DarkGray ($TagsAtCurrentPoint -join '|')

# Only Update changelog if last commit is a full release
if ($UpdateChangelogOnPrerelease)
{
Expand All @@ -193,20 +202,20 @@ task Create_ChangeLog_GitHub_PR -if ($GitHubToken -and (Get-Module -Name PowerSh
}
else
{
Write-Build Yellow "No Release Tag found to update the ChangeLog from"
Write-Build Yellow "No Release Tag found to update the ChangeLog from in '$TagsAtCurrentPoint'"
return
}

$BranchName = "updateChangelogAfter$TagVersion"
Write-Build DarkGray "Creating branch $BranchName"

git checkout -B $BranchName

try
{
Write-Build DarkGray "Updating Changelog file"
Update-Changelog -ReleaseVersion ($TagVersion -replace '^v') -LinkMode None -Path $ChangelogPath -ErrorAction SilentlyContinue
git add $GitHubFilesToAdd
git config user.name $GitHubConfigUserName
git config user.email $GitHubConfigUserEmail
git commit -m "Updating ChangeLog since $TagVersion +semver:skip"

$remoteURL = [URI](git remote get-url origin)
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- GitHub New PR to use Owner/Repo name.
- Updated publish workflow in build.yml to Create GH PR upon release.
- Updated the Readme with the icon.
- Adding delay after creating release to make sure the tag is available at next git pull.

### Fixed

Expand Down
1 change: 0 additions & 1 deletion source/suffix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath 'tasks\*') -Includ
ForEach-Object -Process {
$ModuleName = ([System.IO.FileInfo] $MyInvocation.MyCommand.Name).BaseName
$taskFileAliasName = "$($_.BaseName).$ModuleName.ib.tasks"

Set-Alias -Name $taskFileAliasName -Value $_.FullName

Export-ModuleMember -Alias $taskFileAliasName
Expand Down

0 comments on commit cf0465f

Please sign in to comment.