Skip to content

Commit

Permalink
build: Don't use tag builds on Azure for releases
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
qdot committed Mar 9, 2019
1 parent ad5fe12 commit 8f27d52
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Buttplug.ProjectFiles/CommonProjectProperties.targets
Expand Up @@ -31,7 +31,7 @@

<PackageVersion Condition="'$(CI)' != 'true' and '$(GitCommits)' != '0'">$(GitBaseTag)-$(GitBranch)-$(GitCommit)</PackageVersion>
<PackageVersion Condition="'$(CI)' == 'true' and '$(GitCommits)' != '0'">$(GitBaseTag).$(BUILD_BUILDID)-$(GitBranch)-$(GitCommit)</PackageVersion>
<PackageVersion Condition="'$(GitBranch)' == 'master' and '$(GitCommits)' == '0'">$(GitBaseTag)</PackageVersion>
<PackageVersion Condition="'$(GitCommits)' == '0'">$(GitBaseTag)</PackageVersion>
</PropertyGroup>
</Target>
</Project>
30 changes: 14 additions & 16 deletions azure-pipelines.yml
Expand Up @@ -3,9 +3,6 @@ trigger:
include:
- master
- dev
tags:
include:
- '*'

pr:
branches:
Expand Down Expand Up @@ -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
Expand All @@ -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: |
Expand All @@ -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:
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
7 changes: 7 additions & 0 deletions 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:
Expand Down

0 comments on commit 8f27d52

Please sign in to comment.