Skip to content

Commit

Permalink
Merge pull request #147 from theohbrothers/enhancement/ci-simplify-az…
Browse files Browse the repository at this point in the history
…ure-pipelines-generate-and-release-remote-templates

Enhancement (ci): Simplify azure-pipelines generate and release remote templates
  • Loading branch information
joeltimothyoh authored Jul 9, 2024
2 parents 265cc64 + 6292321 commit f656de8
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 30 deletions.
6 changes: 0 additions & 6 deletions templates/azure-pipelines/entrypoint/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ steps:
### Begin CI-specific code: Get the namspace, project name, and tag ref
$matchInfo = $env:BUILD_SOURCEBRANCH | Select-String -Pattern '^refs\/tags\/(.*)'
$env:RELEASE_TAG_REF = if ($matchInfo) { $matchInfo.Matches.Groups[1].Value } else { $null }
$matchInfo = $env:BUILD_REPOSITORY_URI | Select-String -Pattern '^https:\/\/github.com\/(.*?)\/(.*)'
$env:RELEASE_NAMESPACE = if ($matchInfo) { $matchInfo.Matches.Groups[1].Value } else { $null }
$env:RELEASE_REPOSITORY = if ($matchInfo) { $matchInfo.Matches.Groups[2].Value } else { $null }
### End of CI-specific code
"Namespace: '$env:RELEASE_NAMESPACE'" | Write-Host
"Repository: '$env:RELEASE_REPOSITORY'" | Write-Host
"Tag ref: '$env:RELEASE_TAG_REF'" | Write-Host
$VerbosePreference = 'Continue'
$releaseNotesPath = .\build\PSRepositoryReleaseManager\src\scripts\ci\Invoke-Generate.ps1
Get-Content -Path $releaseNotesPath
Expand Down
6 changes: 0 additions & 6 deletions templates/azure-pipelines/entrypoint/powershell/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ steps:
### Begin CI-specific code: Get the namspace, project name, and tag ref
$matchInfo = $env:BUILD_SOURCEBRANCH | Select-String -Pattern '^refs\/tags\/(.*)'
$env:RELEASE_TAG_REF = if ($matchInfo) { $matchInfo.Matches.Groups[1].Value } else { $null }
$matchInfo = $env:BUILD_REPOSITORY_URI | Select-String -Pattern '^https:\/\/github.com\/(.*?)\/(.*)'
$env:RELEASE_NAMESPACE = if ($matchInfo) { $matchInfo.Matches.Groups[1].Value } else { $null }
$env:RELEASE_REPOSITORY = if ($matchInfo) { $matchInfo.Matches.Groups[2].Value } else { $null }
### End of CI-specific code
"Namespace: '$env:RELEASE_NAMESPACE'" | Write-Host
"Repository: '$env:RELEASE_REPOSITORY'" | Write-Host
"Tag ref: '$env:RELEASE_TAG_REF'" | Write-Host
$VerbosePreference = 'Continue'
$releaseNotesPath = .\build\PSRepositoryReleaseManager\src\scripts\ci\Invoke-Generate.ps1
Get-Content -Path $releaseNotesPath
Expand Down
5 changes: 1 addition & 4 deletions templates/azure-pipelines/entrypoint/powershell/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ steps:
$env:RELEASE_NAMESPACE = if ($matchInfo) { $matchInfo.Matches.Groups[1].Value } else { $null }
$env:RELEASE_REPOSITORY = if ($matchInfo) { $matchInfo.Matches.Groups[2].Value } else { $null }
### End of CI-specific code
"Namespace: '$env:RELEASE_NAMESPACE'" | Write-Host
"Repository: '$env:RELEASE_REPOSITORY'" | Write-Host
"Tag ref: '$env:RELEASE_TAG_REF'" | Write-Host
$VerbosePreference = 'Continue'
.\build\PSRepositoryReleaseManager\src\scripts\ci\Invoke-Release.ps1 > $null
displayName: Create GitHub release
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
env:
GITHUB_API_TOKEN: $(GITHUB_API_TOKEN)
RELEASE_NAME: ${{ parameters['RELEASE_NAME'] }}
Expand Down
6 changes: 0 additions & 6 deletions templates/azure-pipelines/entrypoint/pwsh/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ steps:
### Begin CI-specific code: Get the namspace, project name, and tag ref
$matchInfo = $env:BUILD_SOURCEBRANCH | Select-String -Pattern '^refs\/tags\/(.*)'
$env:RELEASE_TAG_REF = if ($matchInfo) { $matchInfo.Matches.Groups[1].Value } else { $null }
$matchInfo = $env:BUILD_REPOSITORY_URI | Select-String -Pattern '^https:\/\/github.com\/(.*?)\/(.*)'
$env:RELEASE_NAMESPACE = if ($matchInfo) { $matchInfo.Matches.Groups[1].Value } else { $null }
$env:RELEASE_REPOSITORY = if ($matchInfo) { $matchInfo.Matches.Groups[2].Value } else { $null }
### End of CI-specific code
"Namespace: '$env:RELEASE_NAMESPACE'" | Write-Host
"Repository: '$env:RELEASE_REPOSITORY'" | Write-Host
"Tag ref: '$env:RELEASE_TAG_REF'" | Write-Host
$VerbosePreference = 'Continue'
$releaseNotesPath = .\build\PSRepositoryReleaseManager\src\scripts\ci\Invoke-Generate.ps1
Get-Content -Path $releaseNotesPath
Expand Down
5 changes: 1 addition & 4 deletions templates/azure-pipelines/entrypoint/pwsh/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ steps:
$env:RELEASE_NAMESPACE = if ($matchInfo) { $matchInfo.Matches.Groups[1].Value } else { $null }
$env:RELEASE_REPOSITORY = if ($matchInfo) { $matchInfo.Matches.Groups[2].Value } else { $null }
### End of CI-specific code
"Namespace: '$env:RELEASE_NAMESPACE'" | Write-Host
"Repository: '$env:RELEASE_REPOSITORY'" | Write-Host
"Tag ref: '$env:RELEASE_TAG_REF'" | Write-Host
$VerbosePreference = 'Continue'
.\build\PSRepositoryReleaseManager\src\scripts\ci\Invoke-Release.ps1 > $null
displayName: Create GitHub release
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
env:
GITHUB_API_TOKEN: $(GITHUB_API_TOKEN)
RELEASE_NAME: ${{ parameters['RELEASE_NAME'] }}
Expand Down
5 changes: 1 addition & 4 deletions templates/azure-pipelines/entrypoint/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ steps:
$env:RELEASE_NAMESPACE = if ($matchInfo) { $matchInfo.Matches.Groups[1].Value } else { $null }
$env:RELEASE_REPOSITORY = if ($matchInfo) { $matchInfo.Matches.Groups[2].Value } else { $null }
### End of CI-specific code
"Namespace: '$env:RELEASE_NAMESPACE'" | Write-Host
"Repository: '$env:RELEASE_REPOSITORY'" | Write-Host
"Tag ref: '$env:RELEASE_TAG_REF'" | Write-Host
$VerbosePreference = 'Continue'
.\build\PSRepositoryReleaseManager\src\scripts\ci\Invoke-Release.ps1 > $null
displayName: Create GitHub release
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
env:
GITHUB_API_TOKEN: $(GITHUB_API_TOKEN)
RELEASE_NAME: ${{ parameters['RELEASE_NAME'] }}
Expand Down

0 comments on commit f656de8

Please sign in to comment.