From 4be854e4f77aa0e72cb006fa9629ccdb3c7aa3fe Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 12 Aug 2024 17:31:21 -0700 Subject: [PATCH 1/4] Create GitHub releases for merges into main --- azure-pipelines.yml | 341 +++++++++++++++++++++++--------------------- 1 file changed, 180 insertions(+), 161 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f9c32044cd..32811d3516 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,10 +1,3 @@ -parameters: - - name: testProjects - type: object - default: - - OmniSharp.DotNetTest.Tests - - OmniSharp.MSBuild.Tests,OmniSharp.Roslyn.CSharp.Tests,OmniSharp.Cake.Tests,OmniSharp.Script.Tests,OmniSharp.Stdio.Tests,OmniSharp.Http.Tests,OmniSharp.Tests,OmniSharp.Lsp.Tests - trigger: batch: "true" branches: @@ -12,16 +5,6 @@ trigger: - master - refs/tags/* -pr: - autoCancel: "true" - branches: - include: - - master - - feature/* - paths: - exclude: - - 'CHANGELOG.md' - resources: repositories: - repository: rsg @@ -42,152 +25,188 @@ variables: Artifacts: $(Build.SourcesDirectory)/artifacts/ VstsArtifacts: "$(Artifacts)" DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "true" + IsMaster: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')] + IsRelease: $[startsWith(variables['Build.SourceBranch'], 'refs/tags/v')] + IsBetaRelease: $[and(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), contains(variables['Build.SourceBranch'], '-beta.'))] + IsOfficialRelease: $[and(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), not(contains(variables['Build.SourceBranch'], '-beta.')))] + +stages: + - stage: CreateBetaReleaseTag + displayName: "Tag Beta Release" + condition: variables.IsMaster + jobs: + - job: GitVersion + pool: + vmImage: "windows-2019" + steps: + - template: gitversion/store.yml@rsg + parameters: + NuGetVersion: $(NuGetVersion) + version: $(GitVersionVersion) + + - job: CreateTag + pool: + vmImage: "ubuntu-latest" + dependsOn: GitVersion + steps: + - template: ./.pipelines/init.yml + parameters: + Verbosity: $(Verbosity) + CakeVersion: $(CakeVersion) + DotNetVersion: $(DotNetVersion) + NuGetVersion: $(NuGetVersion) + - task: GitHubRelease@1 + displayName: "GitHub create beta release" + inputs: + gitHubConnection: github + repositoryName: OmniSharp/omnisharp-roslyn + action: create + tag: "v$(GitVersion.SemVer)" + title: "v$(GitVersion.SemVer)" + isDraft: true + isPreRelease: true + addChangeLog: true -jobs: - - job: GitVersion - pool: - vmImage: "windows-2019" - steps: - - template: gitversion/store.yml@rsg - parameters: - NuGetVersion: $(NuGetVersion) - version: $(GitVersionVersion) + - stage: BuildRelease + displayName: "Build Release" + condition: variables.IsRelease + jobs: + - job: GitVersion + pool: + vmImage: "windows-2019" + steps: + - template: gitversion/store.yml@rsg + parameters: + NuGetVersion: $(NuGetVersion) + version: $(GitVersionVersion) - - job: macOS - pool: - vmImage: "macos-12" - dependsOn: GitVersion - steps: - - template: ./.pipelines/init.yml - parameters: - Verbosity: $(Verbosity) - CakeVersion: $(CakeVersion) - DotNetVersion: $(DotNetVersion) - NuGetVersion: $(NuGetVersion) - MonoVersion: $(MonoVersion) - - script: | - echo $PATH - chmod 755 ./build.sh - ./build.sh --configuration Release --verbosity Verbose --target CI --publish-all --archive - displayName: "Build" - - template: ./.pipelines/artifacts.yml - parameters: - Artifacts: $(Artifacts) + - job: macOS + pool: + vmImage: "macos-12" + condition: not(variables.IsMaster) + dependsOn: GitVersion + steps: + - template: ./.pipelines/init.yml + parameters: + Verbosity: $(Verbosity) + CakeVersion: $(CakeVersion) + DotNetVersion: $(DotNetVersion) + NuGetVersion: $(NuGetVersion) + MonoVersion: $(MonoVersion) + - script: | + echo $PATH + chmod 755 ./build.sh + ./build.sh --configuration Release --verbosity Verbose --target CI --publish-all --archive + displayName: "Build" + - template: ./.pipelines/artifacts.yml + parameters: + Artifacts: $(Artifacts) - - job: Linux - pool: - vmImage: "ubuntu-20.04" - dependsOn: GitVersion - steps: - - template: ./.pipelines/init.yml - parameters: - Verbosity: $(Verbosity) - CakeVersion: $(CakeVersion) - DotNetVersion: $(DotNetVersion) - NuGetVersion: $(NuGetVersion) - MonoVersion: $(MonoVersion) - - script: | - chmod 755 ./build.sh - ./build.sh --configuration Release --verbosity Verbose --target CI --publish-all --archive - displayName: "Build" - - template: ./.pipelines/artifacts.yml - parameters: - Artifacts: $(Artifacts) + - job: Linux + pool: + vmImage: "ubuntu-20.04" + condition: not(variables.IsMaster) + dependsOn: GitVersion + steps: + - template: ./.pipelines/init.yml + parameters: + Verbosity: $(Verbosity) + CakeVersion: $(CakeVersion) + DotNetVersion: $(DotNetVersion) + NuGetVersion: $(NuGetVersion) + MonoVersion: $(MonoVersion) + - script: | + chmod 755 ./build.sh + ./build.sh --configuration Release --verbosity Verbose --target CI --publish-all --archive + displayName: "Build" + - template: ./.pipelines/artifacts.yml + parameters: + Artifacts: $(Artifacts) - - job: Windows - pool: - vmImage: "windows-2022" - dependsOn: GitVersion - steps: - - template: ./.pipelines/init.yml - parameters: - Verbosity: $(Verbosity) - CakeVersion: $(CakeVersion) - DotNetVersion: $(DotNetVersion) - NuGetVersion: $(NuGetVersion) - - powershell: .\build.ps1 -configuration Release -verbosity Verbose -target CI --publish-all --archive - displayName: "Build" - - template: ./.pipelines/artifacts.yml - parameters: - Artifacts: $(Artifacts) + - job: Windows + pool: + vmImage: "windows-2022" + condition: not(variables.IsMaster) + dependsOn: GitVersion + steps: + - template: ./.pipelines/init.yml + parameters: + Verbosity: $(Verbosity) + CakeVersion: $(CakeVersion) + DotNetVersion: $(DotNetVersion) + NuGetVersion: $(NuGetVersion) + - powershell: .\build.ps1 -configuration Release -verbosity Verbose -target CI --publish-all --archive + displayName: "Build" + - template: ./.pipelines/artifacts.yml + parameters: + Artifacts: $(Artifacts) - - job: Release - pool: - vmImage: "ubuntu-latest" - dependsOn: - - macOS - - Linux - - Windows - steps: - - task: NuGetToolInstaller@1 - displayName: "Install NuGet" - inputs: - versionSpec: $(NuGetVersion) - - task: DownloadBuildArtifacts@0 - displayName: Download Packages - inputs: - downloadType: "single" - artifactName: "packages" - buildType: "current" - downloadPath: "$(System.ArtifactsDirectory)" - - task: DownloadBuildArtifacts@0 - displayName: Download Deployment - inputs: - downloadType: "single" - artifactName: "deployment" - buildType: "current" - downloadPath: "$(System.ArtifactsDirectory)" - - task: DownloadBuildArtifacts@0 - displayName: Download NuGet - inputs: - downloadType: "single" - artifactName: "nuget" - buildType: "current" - downloadPath: "$(System.ArtifactsDirectory)" - - task: NuGetCommand@2 - displayName: "Push NuGet packages to Azure Artifacts" - inputs: - command: push - nuGetFeedType: internal - packagesToPush: "$(System.ArtifactsDirectory)/nuget/**/*.nupkg" - publishVstsFeed: Builds/omnisharp - allowPackageConflicts: true - condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))) - # Temporarily disable publishing to nuget.org while we attempt to renew authentication. - # - task: NuGetCommand@2 - # displayName: "Push NuGet packages to nuget.org" - # inputs: - # command: push - # nuGetFeedType: external - # packagesToPush: "$(System.ArtifactsDirectory)/nuget/**/*.nupkg" - # publishFeedCredentials: nuget.org - # allowPackageConflicts: true - # condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) - - script: | - AZ_REPO=$(lsb_release -cs) - echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \ - sudo tee /etc/apt/sources.list.d/azure-cli.list - curl -L https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - - sudo apt-get install apt-transport-https - sudo apt-get update && sudo apt-get install azure-cli - az storage blob upload-batch --destination "releases" --source "$(System.ArtifactsDirectory)/deployment/" --overwrite --account-name roslynomnisharp --account-key $BLOB_KEY - displayName: Upload to Azure Storage - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) - env: - BLOB_KEY: $(BLOB_KEY) - - task: GitHubRelease@0 - displayName: "GitHub release (edit)" - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) - inputs: - gitHubConnection: github - repositoryName: OmniSharp/omnisharp-roslyn - action: edit - tag: "$(Build.SourceBranchName)" - title: "$(Build.SourceBranchName)" - assets: "$(System.ArtifactsDirectory)/packages/**/*" - assetUploadMode: replace - # releaseNotesSource: input - # releaseNotes: asdfasdf12 - # isDraft: true - # isPreRelease: true - # addChangeLog: false + - job: Release + pool: + vmImage: "ubuntu-latest" + dependsOn: + - macOS + - Linux + - Windows + steps: + - template: ./.pipelines/init.yml + parameters: + Verbosity: $(Verbosity) + CakeVersion: $(CakeVersion) + DotNetVersion: $(DotNetVersion) + NuGetVersion: $(NuGetVersion) + - task: DownloadBuildArtifacts@0 + displayName: Download Packages + inputs: + downloadType: "single" + artifactName: "packages" + buildType: "current" + downloadPath: "$(System.ArtifactsDirectory)" + - task: DownloadBuildArtifacts@0 + displayName: Download Deployment + inputs: + downloadType: "single" + artifactName: "deployment" + buildType: "current" + downloadPath: "$(System.ArtifactsDirectory)" + - task: DownloadBuildArtifacts@0 + displayName: Download NuGet + inputs: + downloadType: "single" + artifactName: "nuget" + buildType: "current" + downloadPath: "$(System.ArtifactsDirectory)" + - task: NuGetCommand@2 + displayName: "Push NuGet packages to Azure Artifacts" + inputs: + command: push + nuGetFeedType: internal + packagesToPush: "$(System.ArtifactsDirectory)/nuget/**/*.nupkg" + publishVstsFeed: Builds/omnisharp + allowPackageConflicts: true + condition: succeeded() + - task: NuGetCommand@2 + displayName: "Push NuGet packages to nuget.org" + inputs: + command: push + nuGetFeedType: external + packagesToPush: "$(System.ArtifactsDirectory)/nuget/**/*.nupkg" + publishFeedCredentials: nuget.org + allowPackageConflicts: true + condition: and(succeeded(), variables.IsOfficialRelease) + - task: GitHubRelease@1 + displayName: "GitHub release (edit)" + condition: succeeded() + inputs: + gitHubConnection: github + repositoryName: OmniSharp/omnisharp-roslyn + action: edit + tag: "$(Build.SourceBranchName)" + title: "$(Build.SourceBranchName)" + assets: "$(System.ArtifactsDirectory)/packages/**/*" + assetUploadMode: replace + # releaseNotesSource: input + # releaseNotes: asdfasdf12 + # isDraft: true + isPreRelease: $(IsBetaRelease) + # addChangeLog: false From ef5a6e0c68b6586d4f8a0c058f90d8ab824e0df5 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 12 Aug 2024 22:21:19 -0700 Subject: [PATCH 2/4] Update job conditions --- azure-pipelines.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 32811d3516..f96743087e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -33,11 +33,11 @@ variables: stages: - stage: CreateBetaReleaseTag displayName: "Tag Beta Release" - condition: variables.IsMaster jobs: - job: GitVersion pool: vmImage: "windows-2019" + condition: variables.IsMaster steps: - template: gitversion/store.yml@rsg parameters: @@ -69,11 +69,11 @@ stages: - stage: BuildRelease displayName: "Build Release" - condition: variables.IsRelease jobs: - job: GitVersion pool: vmImage: "windows-2019" + condition: variables.IsRelease steps: - template: gitversion/store.yml@rsg parameters: @@ -83,7 +83,6 @@ stages: - job: macOS pool: vmImage: "macos-12" - condition: not(variables.IsMaster) dependsOn: GitVersion steps: - template: ./.pipelines/init.yml @@ -105,7 +104,6 @@ stages: - job: Linux pool: vmImage: "ubuntu-20.04" - condition: not(variables.IsMaster) dependsOn: GitVersion steps: - template: ./.pipelines/init.yml @@ -126,7 +124,6 @@ stages: - job: Windows pool: vmImage: "windows-2022" - condition: not(variables.IsMaster) dependsOn: GitVersion steps: - template: ./.pipelines/init.yml @@ -184,7 +181,6 @@ stages: packagesToPush: "$(System.ArtifactsDirectory)/nuget/**/*.nupkg" publishVstsFeed: Builds/omnisharp allowPackageConflicts: true - condition: succeeded() - task: NuGetCommand@2 displayName: "Push NuGet packages to nuget.org" inputs: @@ -196,7 +192,6 @@ stages: condition: and(succeeded(), variables.IsOfficialRelease) - task: GitHubRelease@1 displayName: "GitHub release (edit)" - condition: succeeded() inputs: gitHubConnection: github repositoryName: OmniSharp/omnisharp-roslyn From 4d3bf1349322bc41916678b9c159797639af1040 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 12 Aug 2024 22:32:11 -0700 Subject: [PATCH 3/4] Fix conditionals --- azure-pipelines.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f96743087e..05a5d1929f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,6 +5,8 @@ trigger: - master - refs/tags/* +pr: none + resources: repositories: - repository: rsg @@ -33,11 +35,11 @@ variables: stages: - stage: CreateBetaReleaseTag displayName: "Tag Beta Release" + condition: eq(variables.IsMaster, true) jobs: - job: GitVersion pool: vmImage: "windows-2019" - condition: variables.IsMaster steps: - template: gitversion/store.yml@rsg parameters: @@ -69,11 +71,11 @@ stages: - stage: BuildRelease displayName: "Build Release" + condition: eq(variables.IsRelease, true) jobs: - job: GitVersion pool: vmImage: "windows-2019" - condition: variables.IsRelease steps: - template: gitversion/store.yml@rsg parameters: @@ -189,7 +191,7 @@ stages: packagesToPush: "$(System.ArtifactsDirectory)/nuget/**/*.nupkg" publishFeedCredentials: nuget.org allowPackageConflicts: true - condition: and(succeeded(), variables.IsOfficialRelease) + condition: and(succeeded(), eq(variables.IsOfficialRelease, true)) - task: GitHubRelease@1 displayName: "GitHub release (edit)" inputs: From cca169793cba23e736b50d611cd700001c3936dc Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 13 Aug 2024 17:41:28 -0700 Subject: [PATCH 4/4] Add a document for how releases are built. --- doc/How-Releases-Are-Made.md | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 doc/How-Releases-Are-Made.md diff --git a/doc/How-Releases-Are-Made.md b/doc/How-Releases-Are-Made.md new file mode 100644 index 0000000000..7950408ee2 --- /dev/null +++ b/doc/How-Releases-Are-Made.md @@ -0,0 +1,41 @@ +# How O# Releases Are Made + +The OmniSharp [release pipeline](https://dev.azure.com/omnisharp/Builds/_build?definitionId=2) runs from the OmniSharp Azure DevOps instance. It is defined in [azure-pipelines.yml](/azure-pipelines.yml). + +## Rolling Beta Builds + +Merges into the master branch generate an empty draft GitHub release with a beta version tag. The tag created for the release then causes a build that uploads the packages. + +```mermaid +sequenceDiagram + autonumber + Maintainer ->> GitHub: Merges PR into the `master` branch + GitHub --) OmniSharp ADO: Merge to `master` triggers pipeline + activate OmniSharp ADO + OmniSharp ADO ->> GitHub: Pulls source for omnisharp-roslyn + note over OmniSharp ADO: Calculates a build version + OmniSharp ADO ->> GitHub: Creates a draft release and `v#35;.#35;.#35;-beta.#35;` tag + deactivate OmniSharp ADO + GitHub --) OmniSharp ADO: `v*` tag creation triggers pipeline + activate OmniSharp ADO + OmniSharp ADO ->> GitHub: Pulls source for omnisharp-roslyn + note over OmniSharp ADO: Builds packages for various platforms + OmniSharp ADO ->> GitHub: Adds packages to release and unmark as draft + deactivate OmniSharp ADO +``` + +## Official Builds + +A maintainer creates an empty draft GitHub release with the appropriate version tag. The tag created for the release then causes a build that uploads the packages. + +```mermaid +sequenceDiagram + autonumber + Maintainer ->> GitHub: Creates draft release with a`v#35;.#35;.#35;` tag + GitHub --) OmniSharp ADO: `v*` tag creation triggers pipeline + activate OmniSharp ADO + OmniSharp ADO ->> GitHub: Pulls source for omnisharp-roslyn + note over OmniSharp ADO: Builds packages for various platforms + OmniSharp ADO ->> GitHub: Adds packages to release and unmark as draft + deactivate OmniSharp ADO +``` \ No newline at end of file