Skip to content

Commit

Permalink
Bump versions (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
BernieWhite authored Mar 4, 2023
1 parent 9e087a1 commit 7f51c92
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 34 deletions.
51 changes: 40 additions & 11 deletions .azure-pipelines/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ stages:
- powershell: ./scripts/pipeline-deps.ps1
displayName: 'Install dependencies'

# Install TFS CLI
- task: TfxInstaller@3
displayName: 'Install tfx-cli'
inputs:
version: 'v0.12.x'
# # Install TFS CLI
# - task: TfxInstaller@3
# displayName: 'Install tfx-cli'
# inputs:
# version: 'v0.14.x'

# Install GitVersion
- pwsh: dotnet tool install --global GitVersion.Tool
displayName: 'Install GitVersion'

# Build extension
- powershell: Invoke-Build -Configuration $(buildConfiguration) -Build $(Build.BuildNumber)
Expand Down Expand Up @@ -103,9 +107,21 @@ stages:
jobs:
- template: jobs/release.yaml
parameters:
name: canary_release
extensionTag: '-canary'
extensionName: 'PSRule (Canary)'
name: unoffical_canary_release
displayName: 'Unoffical'
extensionId: ps-rule
extensionTag: -canary
extensionName: PSRule (Canary)
publisherId: bewhite

- template: jobs/release.yaml
parameters:
name: offical_canary_release
displayName: 'Offical'
extensionId: pipelines
extensionTag: -canary
extensionName: PSRule (Canary)
publisherId: ps-rule

# Release pipeline
- stage: Stable
Expand All @@ -115,7 +131,20 @@ stages:
jobs:
- template: jobs/release.yaml
parameters:
name: stable_release
name: unoffical_stable_release
displayName: 'Unoffical'
extensionId: ps-rule
extensionTag: ''
extensionName: PSRule
extensionVisibility: public
publisherId: bewhite

- template: jobs/release.yaml
parameters:
name: offical_stable_release
displayName: 'Offical'
extensionId: pipelines
extensionTag: ''
extensionName: 'PSRule'
extensionVisibility: 'public'
extensionName: PSRule
extensionVisibility: public
publisherId: ps-rule
62 changes: 48 additions & 14 deletions .azure-pipelines/jobs/release.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,43 @@

parameters:
name: ''
displayName: 'Release'
buildConfiguration: 'Release'
imageName: 'ubuntu-22.04'
publisherId: 'bewhite'
extensionId: 'ps-rule'
extensionTag: ''
extensionName: 'PSRule'
extensionVisibility: 'private'

- name: name
type: string

- name: displayName
type: string

- name: imageName
type: string
default: 'ubuntu-22.04'

- name: buildConfiguration
type: string
default: 'Release'

- name: publisherId
type: string
default: 'bewhite'

- name: extensionId
type: string
default: 'ps-rule'

- name: extensionTag
type: string
default: ''

- name: extensionName
type: string
default: 'PSRule'

- name: extensionVisibility
type: string
default: 'private'

- name: connection
type: string
default: 'Visual Studio Marketplace (bewhite)'

jobs:
- job: ${{ parameters.name }}
Expand All @@ -21,11 +50,15 @@ jobs:
- powershell: ./scripts/pipeline-deps.ps1
displayName: 'Install dependencies'

# Install GitVersion
- pwsh: dotnet tool install --global GitVersion.Tool
displayName: 'Install GitVersion'

# Install TFS CLI
- task: TfxInstaller@3
displayName: 'Install tfx-cli'
inputs:
version: 'v0.12.x'
version: 'v0.14.x'

# Download extension
- task: DownloadPipelineArtifact@1
Expand All @@ -37,23 +70,24 @@ jobs:
# Determine current published version
- task: QueryAzureDevOpsExtensionVersion@3
displayName: 'Query published version'
name: QUERYVERSION
inputs:
connectTo: 'VsTeam'
connectedServiceName: 'Visual Studio Marketplace (bewhite)'
connectedServiceName: ${{ parameters.connection }}
publisherId: ${{ parameters.publisherId }}
extensionId: ${{ parameters.extensionId }}
extensionTag: ${{ parameters.extensionTag }}
versionAction: 'Patch'

# Get extension version
- powershell: Invoke-Build GetVersionInfo -Build $(Build.BuildNumber)
- powershell: Invoke-Build GetVersionInfo -Build $(Build.BuildNumber) -ExtensionTag '${{ parameters.extensionTag }}'
displayName: 'Get extension version'

# Publish extension
- task: PublishAzureDevOpsExtension@3
displayName: 'Publish extension to marketplace'
inputs:
connectedServiceName: 'Visual Studio Marketplace (bewhite)'
connectedServiceName: ${{ parameters.connection }}
fileType: vsix
vsixFile: $(Build.SourcesDirectory)/out/extension/bewhite.ps-rule-*.vsix
publisherId: ${{ parameters.publisherId }}
Expand All @@ -68,7 +102,7 @@ jobs:
- task: IsAzureDevOpsExtensionValid@3
displayName: 'Check extension'
inputs:
connectedServiceName: 'Visual Studio Marketplace (bewhite)'
connectedServiceName: ${{ parameters.connection }}
publisherId: ${{ parameters.publisherId }}
extensionId: ${{ parameters.extensionId }}
extensionTag: ${{ parameters.extensionTag }}
Expand Down
27 changes: 18 additions & 9 deletions pipeline.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ param (
[Parameter(Mandatory = $False)]
[String]$Build = '0.0.1',

[Parameter(Mandatory = $False)]
[String]$ExtensionTag = '',

[Parameter(Mandatory = $False)]
[String]$Configuration = 'Debug'
)
Expand Down Expand Up @@ -35,14 +38,14 @@ if ($version -like '*-*') {
}
}

if ($Env:QUERYAZUREDEVOPSEXTENSIONVERSION_EXTENSION_VERSION) {
Write-Verbose -Message "[Pipeline] -- Using EXTENSION_VERSION: $Env:QUERYAZUREDEVOPSEXTENSIONVERSION_EXTENSION_VERSION";
[String[]]$extensionParts = $Env:QUERYAZUREDEVOPSEXTENSIONVERSION_EXTENSION_VERSION.Split('.', [System.StringSplitOptions]::RemoveEmptyEntries);
[String[]]$versionParts = $version.Split('.', [System.StringSplitOptions]::RemoveEmptyEntries);
if ($Env:QUERYVERSION_EXTENSION_VERSION) {
Write-Verbose -Message "[Pipeline] -- Using EXTENSION_VERSION: $Env:QUERYVERSION_EXTENSION_VERSION";
# [String[]]$extensionParts = $Env:QUERYVERSION_EXTENSION_VERSION.Split('.', [System.StringSplitOptions]::RemoveEmptyEntries);
# [String[]]$versionParts = $version.Split('.', [System.StringSplitOptions]::RemoveEmptyEntries);

if ([System.Version]::Parse($Env:QUERYAZUREDEVOPSEXTENSIONVERSION_EXTENSION_VERSION) -ge [System.Version]::Parse($version)) {
$version = [String]::Join('.', @($versionParts[0], $versionParts[1], $extensionParts[2]));
}
# if ([System.Version]::Parse($Env:QUERYVERSION_EXTENSION_VERSION) -ge [System.Version]::Parse($version)) {
# $version = [String]::Join('.', @($versionParts[0], $versionParts[1], $extensionParts[2]));
# }
}

Write-Host -Object "[Pipeline] -- Using version: $version" -ForegroundColor Green;
Expand Down Expand Up @@ -188,8 +191,14 @@ task VersionExtension {

# Synopsis: This task reads version info if set and configures a build variable
task GetVersionInfo {
Write-Host "[Pipeline] Using EXTENSION_VERSION: $version";
Write-Host "`#`#vso[task.setvariable variable=EXTENSION_VERSION;]$version";
$baseVersion = dotnet-gitversion /showvariable MajorMinorPatch /nofetch;
if (![String]::IsNullOrEmpty($ExtensionTag)) {
$commits = dotnet-gitversion /showvariable CommitsSinceVersionSource /nofetch;
$baseVersion = (Get-Date).ToString("yyyy.M.$commits");
}

Write-Host "[Pipeline] Using EXTENSION_VERSION: $baseVersion";
Write-Host "`#`#vso[task.setvariable variable=EXTENSION_VERSION;]$baseVersion";
}

# Synopsis: Run validation
Expand Down

0 comments on commit 7f51c92

Please sign in to comment.