Skip to content

Commit

Permalink
Merge pull request #2628 from OmniSharp/dev/jorobich/create-beta-rele…
Browse files Browse the repository at this point in the history
…ases

Create GitHub releases for merges into main
  • Loading branch information
JoeRobich authored Aug 14, 2024
2 parents 915163d + cca1697 commit 00ed931
Show file tree
Hide file tree
Showing 2 changed files with 217 additions and 160 deletions.
336 changes: 176 additions & 160 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
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:
include:
- master
- refs/tags/*

pr:
autoCancel: "true"
branches:
include:
- master
- feature/*
paths:
exclude:
- 'CHANGELOG.md'
pr: none

resources:
repositories:
Expand All @@ -42,152 +27,183 @@ 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: eq(variables.IsMaster, true)
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: eq(variables.IsRelease, true)
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"
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"
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"
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
- 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(), eq(variables.IsOfficialRelease, true))
- task: GitHubRelease@1
displayName: "GitHub release (edit)"
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
41 changes: 41 additions & 0 deletions doc/How-Releases-Are-Made.md
Original file line number Diff line number Diff line change
@@ -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
```

0 comments on commit 00ed931

Please sign in to comment.