diff --git a/.azure-pipelines/ci.yml b/.azure-pipelines/ci.yml index 368de31bf..d10afce4f 100644 --- a/.azure-pipelines/ci.yml +++ b/.azure-pipelines/ci.yml @@ -25,12 +25,6 @@ stages: pool: vmImage: $(vmImage) steps: - - script: node .azure-pipelines/setVersionVariables.js - env: - VERSION_PREFIX: $(versionPrefix) - VERSION_SUFFIX: $(versionSuffix) - CI_VERSION_SUFFIX: $(ciVersionSuffix) - displayName: Set version variables - task: DotNetCoreCLI@2 displayName: Build project with CI version inputs: @@ -38,14 +32,14 @@ stages: projects: $(projectPath) arguments: > --configuration $(buildConfiguration) - -p:Version=$(CI_VERSION) + -p:Version=$(ciVersion) -p:CI_EMBED_SYMBOLS=true - bash: > dotnet pack --no-build --output "$(Build.ArtifactStagingDirectory)/packages" --configuration $(buildConfiguration) - -p:Version=$(CI_VERSION) + -p:Version=$(ciVersion) -p:CI_EMBED_SYMBOLS=true $(projectPath) displayName: Create CI nuget package diff --git a/.azure-pipelines/develop-pipeline.yml b/.azure-pipelines/develop-pipeline.yml index fcb297586..e0bd62964 100644 --- a/.azure-pipelines/develop-pipeline.yml +++ b/.azure-pipelines/develop-pipeline.yml @@ -24,9 +24,9 @@ stages: buildConfiguration: $(buildConfiguration) projects: $(unitTestsProject) strategies: - - Windows: windows-2019 + - Windows: windows-2022 - Ubuntu: ubuntu-20.04 - - macOS: macOS-10.15 + - macOS: macOS-11 - stage: IntegrationTests displayName: 🧪 Integration tests jobs: diff --git a/.azure-pipelines/release-pipeline.yml b/.azure-pipelines/release-pipeline.yml index ee001b28b..af91ae03e 100644 --- a/.azure-pipelines/release-pipeline.yml +++ b/.azure-pipelines/release-pipeline.yml @@ -20,12 +20,6 @@ pool: vmImage: $(vmImage) steps: - - script: node .azure-pipelines/setVersionVariables.js - env: - VERSION_PREFIX: $(versionPrefix) - VERSION_SUFFIX: $(versionSuffix) - CI_VERSION_SUFFIX: $(ciVersionSuffix) - displayName: Set version variables - task: DotNetCoreCLI@2 displayName: Build project with release version inputs: @@ -33,13 +27,13 @@ steps: projects: $(projectPath) arguments: > --configuration $(buildConfiguration) - -p:Version=$(RELEASE_VERSION) + -p:Version=$(releaseVersion) - bash: > dotnet pack --no-build --output "$(Build.ArtifactStagingDirectory)/packages" --configuration $(buildConfiguration) - -p:Version=$(RELEASE_VERSION) + -p:Version=$(releaseVersion) $(projectPath) displayName: Create release nuget package - bash: > @@ -54,12 +48,12 @@ steps: action: create target: $(Build.SourceVersion) tagSource: manual - tag: v$(RELEASE_VERSION) - tagPattern: v$(RELEASE_VERSION) - title: v$(RELEASE_VERSION) + tag: v$(releaseVersion) + tagPattern: v$(releaseVersion) + title: v$(releaseVersion) githubConnection: githubRelease repositoryName: $(Build.Repository.Name) - isPreRelease: $(IS_PRE_RELEASE) + isPreRelease: $(isPreRelease) addChangeLog: false assets: $(Build.ArtifactStagingDirectory)/packages/* displayName: Create Github Release diff --git a/.azure-pipelines/setVersionVariables.js b/.azure-pipelines/setVersionVariables.js deleted file mode 100644 index 26caba23f..000000000 --- a/.azure-pipelines/setVersionVariables.js +++ /dev/null @@ -1,40 +0,0 @@ -const assert = require('assert').strict; - -const prefix = process.env['VERSION_PREFIX']; -const suffix = process.env['VERSION_SUFFIX']; -const ciSuffix = process.env['CI_VERSION_SUFFIX']; - -const prefixRegex = /[0-9]+\.[0-9]+\.[0-9]+/; -const ciSuffixRegex = /ci\.[0-9]+\+git\.commit\.[0-9a-z]{40}/; - -assert.ok(prefix, "Version prefix is empty"); -assert.ok(ciSuffix, "CI version suffix is empty"); -assert.ok(prefixRegex.test(prefix), "Version prefix is invalid"); -assert.ok(ciSuffixRegex.test(ciSuffix), "CI version prefix is invalid"); - -const releaseVersionCommand = createCommand( - 'RELEASE_VERSION', - suffix && suffix.length > 0 - ? `${prefix}-${suffix}` - : `${prefix}` -); - -const ciVersionCommand = createCommand( - 'CI_VERSION', - suffix && suffix.length > 0 - ? `${prefix}-${suffix}.${ciSuffix}` - : `${prefix}-${ciSuffix}` -); - -const isPreRelease = createCommand( - 'IS_PRE_RELEASE', - suffix && suffix.length > 0 ? true : false -); - -console.log(releaseVersionCommand); -console.log(ciVersionCommand); -console.log(isPreRelease); - -function createCommand(key, value) { - return `##vso[task.setvariable variable=${key};]${value}` -} diff --git a/.azure-pipelines/variables.yml b/.azure-pipelines/variables.yml index 3554ca6bd..2b598ec00 100644 --- a/.azure-pipelines/variables.yml +++ b/.azure-pipelines/variables.yml @@ -3,9 +3,21 @@ variables: - name: versionPrefix value: 17.0.0 - name: versionSuffix - value: "alpha.5" + value: '' - name: ciVersionSuffix value: ci.$(Build.BuildId)+git.commit.$(Build.SourceVersion) + - name: isPreRelease + value: ${{ ne(variables.versionSuffix, '') }} + - name: releaseVersion + ${{ if eq(variables.isPreRelease, true) }}: + value: $(versionPrefix)-$(versionSuffix) + ${{ else }}: + value: $(versionPrefix) + - name: ciVersion + ${{ if eq(variables.isPreRelease, true) }}: + value: $(versionPrefix)-$(versionSuffix).$(ciVersionSuffix) + ${{ else }}: + value: $(versionPrefix)-$(ciVersionSuffix) - name: buildConfiguration value: Release - name: vmImage diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 000000000..5dc5877cf --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1 @@ +image: gitpod/workspace-dotnet \ No newline at end of file diff --git a/Telegram.Bot.sln b/Telegram.Bot.sln index ab9a5cdae..879fd9536 100644 --- a/Telegram.Bot.sln +++ b/Telegram.Bot.sln @@ -28,7 +28,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".azure-pipelines", ".azure- .azure-pipelines\develop-pipeline.yml = .azure-pipelines\develop-pipeline.yml .azure-pipelines\manual-pipeline.yml = .azure-pipelines\manual-pipeline.yml .azure-pipelines\release-pipeline.yml = .azure-pipelines\release-pipeline.yml - .azure-pipelines\setVersionVariables.js = .azure-pipelines\setVersionVariables.js .azure-pipelines\variables.yml = .azure-pipelines\variables.yml EndProjectSection EndProject