From 8f27d52cea2e1a365a5f8e3691ca8f480afbb64e Mon Sep 17 00:00:00 2001 From: Kyle Machulis Date: Fri, 8 Mar 2019 23:18:13 -0800 Subject: [PATCH] build: Don't use tag builds on Azure for releases Ignore tag builds on Azure, as they cause GitInfo to freak out for some reason. Instead, just calculate our own tags based against the current head and let GitInfo do its own thing. We can safely assume any build on master is a release build, and the deploy step will fail trying to pull a tag if it isn't. --- .../CommonProjectProperties.targets | 2 +- azure-pipelines.yml | 30 +++++++++---------- build/setup-variables.yml | 7 +++++ 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/Buttplug.ProjectFiles/CommonProjectProperties.targets b/Buttplug.ProjectFiles/CommonProjectProperties.targets index 7bd01059..f61fc1a6 100644 --- a/Buttplug.ProjectFiles/CommonProjectProperties.targets +++ b/Buttplug.ProjectFiles/CommonProjectProperties.targets @@ -31,7 +31,7 @@ $(GitBaseTag)-$(GitBranch)-$(GitCommit) $(GitBaseTag).$(BUILD_BUILDID)-$(GitBranch)-$(GitCommit) - $(GitBaseTag) + $(GitBaseTag) \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2144a673..d5541b57 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,9 +3,6 @@ trigger: include: - master - dev - tags: - include: - - '*' pr: branches: @@ -100,7 +97,7 @@ jobs: - Windows - MacOS - Linux - condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/dev'), contains(variables['Build.SourceBranch'], 'refs/tags/'))) + condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/dev'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))) steps: - task: PowerShell@2 displayName: Documentation Generation @@ -125,7 +122,7 @@ jobs: artifactName: "buttplug-csharp-docs" - task: PowerShell@2 displayName: Deploy Master Documentation to Netlify - condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/')) + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) inputs: targetType: inline script: | @@ -144,7 +141,7 @@ jobs: - Windows - MacOS - Linux - condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/dev'), contains(variables['Build.SourceBranch'], 'refs/tags/'))) + condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/dev'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))) pool: vmImage: 'vs2017-win2016' steps: @@ -162,17 +159,9 @@ jobs: codecov.exe -f "$(System.ArtifactsDirectory)/win-x64-Debug/coverage.xml" -t $(CODECOV_TOKEN) displayName: Upload coverage to codecov. continueOnError: true - - task: NuGetCommand@2 - displayName: "Push NuGet packages to NuGet.org" - inputs: - command: "push" - nuGetFeedType: "external" - packagesToPush: "$(System.ArtifactsDirectory)/**/Release/**/!(*.symbols).nupkg" - allowPackageConflicts: false - publishFeedCredentials: "NuGet.org" - task: GitHubRelease@0 displayName: Upload CLI Prerelease to Github - condition: not(contains(variables['Build.SourceBranch'], 'refs/tags/')) + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev')) inputs: gitHubConnection: "release" repositoryName: "buttplugio/buttplug-csharp" @@ -184,7 +173,7 @@ jobs: isPreRelease: true - task: GitHubRelease@0 displayName: Upload CLI Release to Github - condition: contains(variables['Build.SourceBranch'], 'refs/tags/') + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) inputs: gitHubConnection: "release" repositoryName: "buttplugio/buttplug-csharp" @@ -193,3 +182,12 @@ jobs: title: "Buttplug C# CLI $(gitVersion)" assets: "$(System.ArtifactsDirectory)/**/*.zip" isPreRelease: false + - task: NuGetCommand@2 + displayName: "Push NuGet packages to NuGet.org" + condition: succeeded() + inputs: + command: "push" + nuGetFeedType: "external" + packagesToPush: "$(System.ArtifactsDirectory)/**/Release/**/!(*.symbols).nupkg" + allowPackageConflicts: false + publishFeedCredentials: "NuGet.org" diff --git a/build/setup-variables.yml b/build/setup-variables.yml index 7b5e73a0..9a57c608 100644 --- a/build/setup-variables.yml +++ b/build/setup-variables.yml @@ -1,4 +1,11 @@ steps: + - task: Bash@3 + displayName: "Remove prerelease tag" + continueOnError: true + inputs: + targetType: inline + script: | + git tag -d 420.69.666 - task: Bash@3 displayName: "Set Up Build Variables" inputs: