mirror of
https://github.com/actions/versions-package-tools.git
synced 2025-12-10 19:50:24 +00:00
Merge pull request #18 from actions/v-malob/fix-yaml-publish
Fix notifications about new versions
This commit is contained in:
@@ -20,26 +20,38 @@ variables:
|
|||||||
VmImage: 'ubuntu-18.04'
|
VmImage: 'ubuntu-18.04'
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- stage: Get_New_Versions
|
- stage: Find_New_Versions
|
||||||
dependsOn: []
|
dependsOn: []
|
||||||
jobs:
|
jobs:
|
||||||
- job: Get_Tool_Versions
|
- job: Find_New_Versions
|
||||||
pool:
|
pool:
|
||||||
name: $(PoolName)
|
name: $(PoolName)
|
||||||
vmImage: $(VmImage)
|
vmImage: $(VmImage)
|
||||||
steps:
|
steps:
|
||||||
- template: /azure-pipelines/templates/get-tool-versions-steps.yml
|
- template: /azure-pipelines/templates/get-tool-versions-steps.yml
|
||||||
|
|
||||||
|
- stage: Check_New_Versions
|
||||||
|
dependsOn: Find_New_Versions
|
||||||
|
jobs:
|
||||||
|
- job: Check_New_Versions
|
||||||
|
pool:
|
||||||
|
name: $(PoolName)
|
||||||
|
vmImage: $(VmImage)
|
||||||
|
variables:
|
||||||
|
ToolVersions: $[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ]
|
||||||
|
steps:
|
||||||
|
- template: /azure-pipelines/templates/check-versions.yml
|
||||||
|
|
||||||
- stage: Trigger_Builds
|
- stage: Trigger_Builds
|
||||||
dependsOn: Get_New_Versions
|
dependsOn: Check_New_Versions
|
||||||
condition: and(succeeded(), ne(stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'], ''), ne(variables['WORKFLOW_FILE_NAME'], ''))
|
condition: and(succeeded(), ne(variables['WORKFLOW_FILE_NAME'], ''))
|
||||||
jobs:
|
jobs:
|
||||||
- deployment: Run_Builds
|
- deployment: Run_Builds
|
||||||
pool:
|
pool:
|
||||||
name: $(PoolName)
|
name: $(PoolName)
|
||||||
vmImage: $(VmImage)
|
vmImage: $(VmImage)
|
||||||
variables:
|
variables:
|
||||||
ToolVersions: $[ stageDependencies.Get_New_Versions.Get_Tool_Versions.outputs['Get_versions.TOOL_VERSIONS'] ]
|
ToolVersions: $[ stageDependencies.Find_New_Versions.Find_New_Versions.outputs['Get_versions.TOOL_VERSIONS'] ]
|
||||||
timeoutInMinutes: 180
|
timeoutInMinutes: 180
|
||||||
environment: 'Get Available Tools Versions - Publishing Approval'
|
environment: 'Get Available Tools Versions - Publishing Approval'
|
||||||
strategy:
|
strategy:
|
||||||
|
|||||||
41
azure-pipelines/templates/check-versions.yml
Normal file
41
azure-pipelines/templates/check-versions.yml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
steps:
|
||||||
|
- task: PowerShell@2
|
||||||
|
displayName: Check Versions
|
||||||
|
condition: and(succeeded(), eq(variables.ToolVersions, ''))
|
||||||
|
inputs:
|
||||||
|
TargetType: inline
|
||||||
|
script: |
|
||||||
|
throw "No new versions were found"
|
||||||
|
|
||||||
|
- task: PowerShell@2
|
||||||
|
displayName: 'Set PIPELINE_URL variable'
|
||||||
|
inputs:
|
||||||
|
TargetType: inline
|
||||||
|
script: |
|
||||||
|
$ToolName = "$(TOOL_NAME)"
|
||||||
|
if ($ToolName -eq "Python") {
|
||||||
|
$PipelineUrl = " "
|
||||||
|
} else {
|
||||||
|
$PipelineUrl = "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)"
|
||||||
|
}
|
||||||
|
Write-Host "##vso[task.setvariable variable=PIPELINE_URL]$PipelineUrl"
|
||||||
|
|
||||||
|
- task: PowerShell@2
|
||||||
|
displayName: 'Change build name'
|
||||||
|
inputs:
|
||||||
|
TargetType: inline
|
||||||
|
script: |
|
||||||
|
$newBuildName = "[FOUND] $(Build.BuildNumber)"
|
||||||
|
Write-Host "##vso[build.updatebuildnumber]$newBuildName"
|
||||||
|
|
||||||
|
- task: PowerShell@2
|
||||||
|
displayName: 'Send Slack notification'
|
||||||
|
inputs:
|
||||||
|
targetType: filePath
|
||||||
|
filePath: './get-new-tool-versions/send-slack-notification.ps1'
|
||||||
|
arguments: |
|
||||||
|
-Url "$(SLACK_CHANNEL_URL)" `
|
||||||
|
-ToolName "$(TOOL_NAME)" `
|
||||||
|
-ToolVersion "$(ToolVersions)" `
|
||||||
|
-PipelineUrl "$(PIPELINE_URL)" `
|
||||||
|
-ImageUrl "$(IMAGE_URL)"
|
||||||
@@ -6,35 +6,4 @@ steps:
|
|||||||
targetType: filePath
|
targetType: filePath
|
||||||
filePath: './get-new-tool-versions/get-new-tool-versions.ps1'
|
filePath: './get-new-tool-versions/get-new-tool-versions.ps1'
|
||||||
arguments: |
|
arguments: |
|
||||||
-ToolName "$(TOOL_NAME)"
|
-ToolName "$(TOOL_NAME)"
|
||||||
|
|
||||||
- task: PowerShell@2
|
|
||||||
displayName: 'Set PIPELINE_URL variable'
|
|
||||||
condition: and(succeeded(), ne(variables['TOOL_NAME'], 'Python'))
|
|
||||||
inputs:
|
|
||||||
TargetType: inline
|
|
||||||
script: |
|
|
||||||
$PipelineUrl = "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)"
|
|
||||||
Write-Host "##vso[task.setvariable variable=PIPELINE_URL]$PipelineUrl"
|
|
||||||
|
|
||||||
- task: PowerShell@2
|
|
||||||
displayName: 'Change build name'
|
|
||||||
condition: and(succeeded(), ne(variables['Get_versions.TOOL_VERSIONS'], ''))
|
|
||||||
inputs:
|
|
||||||
TargetType: inline
|
|
||||||
script: |
|
|
||||||
$newBuildName = "[FOUND] $(Build.BuildNumber)"
|
|
||||||
Write-Host "##vso[build.updatebuildnumber]$newBuildName"
|
|
||||||
|
|
||||||
- task: PowerShell@2
|
|
||||||
displayName: 'Send Slack notification'
|
|
||||||
condition: and(succeeded(), ne(variables['Get_versions.TOOL_VERSIONS'], ''))
|
|
||||||
inputs:
|
|
||||||
targetType: filePath
|
|
||||||
filePath: './get-new-tool-versions/send-slack-notification.ps1'
|
|
||||||
arguments: |
|
|
||||||
-Url "$(SLACK_CHANNEL_URL)" `
|
|
||||||
-ToolName "$(TOOL_NAME)" `
|
|
||||||
-ToolVersion "$(Get_versions.TOOL_VERSIONS)" `
|
|
||||||
-PipelineUrl "${{ variables.PIPELINE_URL }}" `
|
|
||||||
-ImageUrl "$(IMAGE_URL)"
|
|
||||||
@@ -36,7 +36,7 @@ Import-Module $PSScriptRoot/helpers.psm1 -DisableNameChecking
|
|||||||
|
|
||||||
# Create JSON body
|
# Create JSON body
|
||||||
$text = "The following versions of '$toolName' are available to upload: $toolVersion"
|
$text = "The following versions of '$toolName' are available to upload: $toolVersion"
|
||||||
if ($PipelineUrl) {
|
if (-not ([string]::IsNullOrWhiteSpace($PipelineUrl))) {
|
||||||
$text += "\nLink to the pipeline: $pipelineUrl"
|
$text += "\nLink to the pipeline: $pipelineUrl"
|
||||||
}
|
}
|
||||||
$jsonBodyMessage = @"
|
$jsonBodyMessage = @"
|
||||||
|
|||||||
Reference in New Issue
Block a user