Skip to content

Commit

Permalink
Create GitHub releases for merges into main
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich committed Aug 13, 2024
1 parent 915163d commit 4be854e
Showing 1 changed file with 180 additions and 161 deletions.
341 changes: 180 additions & 161 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
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'

resources:
repositories:
- repository: rsg
Expand All @@ -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

0 comments on commit 4be854e

Please sign in to comment.