From 86348e3269fddb81b9361ec7ee69d83ab043fdfc Mon Sep 17 00:00:00 2001 From: Feng Chang Date: Thu, 23 Jul 2020 17:01:49 +0800 Subject: [PATCH 1/6] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 149 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 116 insertions(+), 33 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ca25b61..8cac911 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,36 +9,119 @@ trigger: tags: include: ['*'] -strategy: - matrix: - linux: - imageName: 'ubuntu-latest' - -pool: - vmImage: $(imageName) - -steps: -- task: NodeTool@0 - inputs: - versionSpec: '10.x' - displayName: 'Install Node.js' - -- bash: | - /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & - echo ">>> Started xvfb" - displayName: Start xvfb - condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) - -- bash: | - echo ">>> Compile vscode-test" - yarn && yarn compile && yarn test - echo ">>> Compiled vscode-test" - displayName: Run Tests - env: - DISPLAY: ':99.0' - -- bash: | - echo ">>> Publish" - yarn deploy -p $(VSCODE_MARKETPLACE_TOKEN) - displayName: Publish - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['Agent.OS'], 'Linux')) +stages: +- stage: BuildAndTest + displayName: Build and Test + + jobs: + - job: BuildAndTest + strategy: + matrix: + linux: + imageName: 'ubuntu-latest' + pool: + vmImage: $(imageName) + + steps: + - task: NodeTool@0 + inputs: + versionSpec: '10.x' + displayName: 'Install Node.js' + + - bash: | + /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & + echo ">>> Started xvfb" + displayName: Start xvfb + condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) + + - bash: | + echo ">>> Compile newline" + yarn && yarn compile && yarn test + echo ">>> Compiled newline" + displayName: Run Tests + env: + DISPLAY: ':99.0' + +- stage: Package + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') + jobs: + - job: PackageRelease + pool: + vmImage: 'ubuntu-latest' + + steps: + - checkout: self + submodules: true + + - task: NodeTool@0 + inputs: + versionSpec: '10.x' + displayName: 'Install Node.js' + + - bash: | + echo ">>> Package newline" + yarn && yarn run package + displayName: Package + + - task: CopyFiles@2 + inputs: + Contents: '*.vsix' + TargetFolder: '$(Build.ArtifactStagingDirectory)' + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)' + ArtifactName: 'release' + publishLocation: 'Container' + +- stage: DeployMarketplace + displayName: 'Deploy to Marketplace' + dependsOn: [Package] + jobs: + - deployment: DeployMarketplaceProduction + pool: + vmImage: 'ubuntu-latest' + environment: 'Production' + strategy: + runOnce: + deploy: + steps: + - download: current + artifact: release + - bash: | + sudo yarn global add vsce + PACKAGE_FILENAME=$(find $(Pipeline.Workspace) -type f -name "*.vsix") + vsce publish --yarn -p $MARKET_KEY --packagePath $PACKAGE_FILENAME + env: + MARKET_KEY: $(VSCODE_MARKETPLACE_TOKEN) + +- stage: DeployGithub + displayName: 'Deploy to Github' + dependsOn: [Package] + jobs: + - deployment: DeployGithubRelease + pool: + vmImage: 'ubuntu-latest' + environment: 'Github' + strategy: + runOnce: + deploy: + steps: + - download: current + artifact: release + - bash: | + PACKAGE_FILENAME=$(find $(Pipeline.Workspace) -type f -name "*.vsix") + echo ">>>> FILENAME" + echo "$PACKAGE_FILENAME" + echo "$(Build.SourceVersion)" + - task: GitHubRelease@1 + inputs: + gitHubConnection: 'release' + repositoryName: '$(Build.Repository.Name)' + action: create + target: $(Build.SourceVersion) + tagSource: gitTag + releaseNotesSource: inline + isPreRelease: true + addChangeLog: false + assets: $(Pipeline.Workspace)/release/*.vsix From 5772f5c108ac491472b7a85dd18c034af4d352a8 Mon Sep 17 00:00:00 2001 From: Feng Chang Date: Thu, 23 Jul 2020 17:24:13 +0800 Subject: [PATCH 2/6] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8cac911..1c26a1b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -116,12 +116,12 @@ stages: echo "$(Build.SourceVersion)" - task: GitHubRelease@1 inputs: - gitHubConnection: 'release' + gitHubConnection: 'Github-PAT-chang196700' repositoryName: '$(Build.Repository.Name)' - action: create - target: $(Build.SourceVersion) - tagSource: gitTag - releaseNotesSource: inline + action: 'create' + target: '$(Build.SourceVersion)' + tagSource: 'gitTag' + releaseNotesSource: 'inline' + assets: '$(Pipeline.Workspace)/release/*.vsix' isPreRelease: true addChangeLog: false - assets: $(Pipeline.Workspace)/release/*.vsix From 3d003fb38d1902acd9997b94759cba8669b723af Mon Sep 17 00:00:00 2001 From: Feng Chang Date: Thu, 23 Jul 2020 17:27:34 +0800 Subject: [PATCH 3/6] Update azure-pipelines.yml for Azure Pipelines (Test) --- azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1c26a1b..48c3f93 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -43,7 +43,7 @@ stages: DISPLAY: ':99.0' - stage: Package - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') + # condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') jobs: - job: PackageRelease pool: @@ -77,6 +77,7 @@ stages: - stage: DeployMarketplace displayName: 'Deploy to Marketplace' dependsOn: [Package] + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') jobs: - deployment: DeployMarketplaceProduction pool: From 9af971e6776b3d1a69281f66edba75ec6f21dde5 Mon Sep 17 00:00:00 2001 From: Feng Chang Date: Thu, 23 Jul 2020 17:32:01 +0800 Subject: [PATCH 4/6] Update azure-pipelines.yml for Azure Pipelines (Test) --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 48c3f93..672fd69 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -60,7 +60,7 @@ stages: - bash: | echo ">>> Package newline" - yarn && yarn run package + yarn && vsce package displayName: Package - task: CopyFiles@2 From 449758a56dd6ca53cae625079abc61095d1ed3d3 Mon Sep 17 00:00:00 2001 From: Feng Chang Date: Thu, 23 Jul 2020 17:47:39 +0800 Subject: [PATCH 5/6] Update azure-pipelines.yml for Azure Pipelines (Test) --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 672fd69..0aff4b4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -60,7 +60,7 @@ stages: - bash: | echo ">>> Package newline" - yarn && vsce package + yarn && yarn vsce package displayName: Package - task: CopyFiles@2 From c16b250875fc8ececeb28d3f80942cf323db111a Mon Sep 17 00:00:00 2001 From: Feng Chang Date: Thu, 23 Jul 2020 17:52:17 +0800 Subject: [PATCH 6/6] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0aff4b4..044f8ac 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -43,7 +43,7 @@ stages: DISPLAY: ':99.0' - stage: Package - # condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') jobs: - job: PackageRelease pool: @@ -77,7 +77,6 @@ stages: - stage: DeployMarketplace displayName: 'Deploy to Marketplace' dependsOn: [Package] - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') jobs: - deployment: DeployMarketplaceProduction pool: