Move release and PR creation to the GitHub Actions

This commit is contained in:
MaksimZhukov
2020-08-28 14:14:38 +03:00
parent 87b41b829e
commit a3078ebf0c
5 changed files with 112 additions and 1 deletions

View File

@ -116,3 +116,17 @@ stages:
Architecture: x86
jobs:
- template: /azure-pipelines/templates/test-job.yml
- stage: Publish_Release
dependsOn: [Test_Python_MacOS, Test_Python_Ubuntu_1604, Test_Python_Ubuntu_1804, Test_Python_Ubuntu_2004, Test_Python_x64_Windows, Test_Python_x86_Windows]
jobs:
- deployment: Publish_Release
pool:
name: Azure Pipelines
vmImage: ubuntu-18.04
environment: 'Get Available Tools Versions - Publishing Approval'
strategy:
runOnce:
deploy:
steps:
- template: /azure-pipelines/templates/publish-release-steps.yml

View File

@ -0,0 +1,46 @@
steps:
- download: none
- checkout: self
submodules: true
- task: DownloadPipelineArtifact@2
inputs:
source: 'current'
path: $(Build.BinariesDirectory)
- task: PowerShell@2
displayName: 'Create release Python $(VERSION)'
inputs:
TargetType: inline
script: |
$tagName = "$(VERSION)-$(Build.BuildId)"
$releaseBody = "Python $(VERSION)"
./helpers/github/create-release.ps1 -RepositoryFullName "$(Build.Repository.Name)" `
-AccessToken "$(GITHUB_TOKEN)" `
-ToolVersion "$(VERSION)" `
-TagName "$tagName" `
-ReleaseBody "$releaseBody" `
-EventType "$(EVENT_TYPE)"
- task: GitHubRelease@1
displayName: 'Upload release assets'
inputs:
gitHubConnection: 'Github Connection'
action: edit
tag: '$(VERSION)-$(Build.BuildId)'
title: '$(VERSION)'
releaseNotesSource: inline
releaseNotesInline: '$(RELEASE_NOTES_CONTENT)'
assets: '$(Build.BinariesDirectory)/*/*'
assetUploadMode: replace
addChangeLog: false
- task: PowerShell@2
displayName: 'Trigger "Create Pull Request" workflow'
inputs:
TargetType: inline
script: |
Import-Module (Join-Path (Get-Location).Path "github-api.psm1")
$gitHubApi = Get-GitHubApi -RepositoryFullName "$(Build.Repository.Name)" -AccessToken "$(GITHUB_TOKEN)"
$gitHubApi.CreateWorkflowDispatch("$(WORKFLOW_FILE_NAME)", "$(WORKFLOW_DISPATCH_REF)", "$(INPUTS)")
workingDirectory: '$(Build.SourcesDirectory)/helpers/github'