Skip to content

Commit

Permalink
Use git tag name to populate version number during deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
peterkeating committed Jan 5, 2023
1 parent b5966be commit 74144c1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Etch.OrchardCore.ContentPermissions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.3.1</Version>
<Version>$(VersionNumber)</Version>
<PackageId>Etch.OrchardCore.ContentPermissions</PackageId>
<Title>Content Permissions</Title>
<Authors>Etch UK Ltd.</Authors>
Expand Down
2 changes: 1 addition & 1 deletion Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
Category = "Security",
Description = "Configuring access at a per content item level.",
Name = "Content Permissions",
Version = "1.3.1",
Version = "$(VersionNumber)",
Website = "https://etchuk.com"
)]
20 changes: 15 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ trigger:

variables:
buildConfiguration: "Release"
VersionNumber: "1.0.0"

stages:
- stage: build
Expand All @@ -22,6 +23,10 @@ stages:
pool:
vmImage: "windows-latest"
steps:
- script: |
echo ##vso[task.setvariable variable=VersionNumber;]$(Build.SourceBranchName)
condition: startsWith(variables['build.sourceBranch'], 'refs/tags/')
- task: SonarCloudPrepare@1
displayName: "Prepare SonarCloud Analysis"
inputs:
Expand All @@ -31,10 +36,17 @@ stages:
projectKey: "Etch.OrchardCore.ContentPermissions"
projectName: "Etch.OrchardCore.ContentPermissions"

- task: tmarkovski.projectversionasvariable.versionintovariable.projectversionasvariable@1
displayName: "Get Project Version as variables from Etch.OrchardCore.ContentPermissions.csproj"
- task: replacetokens@5
inputs:
path: ./Etch.OrchardCore.ContentPermissions.csproj
rootDirectory: '$(System.DefaultWorkingDirectory)'
targetFiles: |
"**/*Manifest.cs"
"**/*Etch.OrchardCore.Fields.csproj"
actionOnMissing: "fail"
tokenPrefix: "$("
tokenSuffix: ")"
writeBOM: false
encoding: 'utf-8'

- task: DotNetCoreCLI@2
displayName: "Build module"
Expand All @@ -50,8 +62,6 @@ stages:
inputs:
command: pack
packagesToPack: "./Etch.OrchardCore.ContentPermissions.csproj"
versioningScheme: byEnvVar
versionEnvVar: "VERSION_MAJORMINORPATCH"

- task: PublishPipelineArtifact@0
displayName: "Publish Pipeline Artifact"
Expand Down

0 comments on commit 74144c1

Please sign in to comment.