Use single extension with prerelease flag via pipeline parameter (#741)

* Use single extension with prerelease flag via pipelien parameter

* cleanup

* Use Release-It to handle incrementing the version in official builds

* Remove Version variable, set values from NPM package after release-it
This commit is contained in:
Crash Collison 2023-10-27 21:10:45 -07:00 коммит произвёл GitHub
Родитель 7a1f049ca3
Коммит df54ee5de3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 3493 добавлений и 123 удалений

Просмотреть файл

@ -4,6 +4,12 @@
#
# Official build to produce versioned and signed VSIX
parameters:
- name: isPreRelease
displayName: 'Build as pre-release extension'
type: boolean
default: true
variables:
# https://aka.ms/gdn-injection
GDN_CODESIGN_TARGETDIRECTORY: "$(Build.SourcesDirectory)\\package"
@ -15,7 +21,6 @@ variables:
# set the following in the pipeline's web UI editor:
# GITHUB_TOKEN # GitHub PAT with scopes: repo; must have SSO enabled for GH org 'microsoft' for corp user
# AZ_DevOps_Read_PAT # PAT to read from AzDO feed in msazure
# VSIX_VERSION # VSIX package/release version; must be manually managed for now!
# trigger:
# - release/*
@ -27,12 +32,6 @@ pool:
vmImage: 'windows-latest'
steps:
- script: echo "##vso[build.updatebuildnumber]$(VSIX_VERSION)
displayName: Set Job version
- script: mkdir package && echo $(VSIX_VERSION),$(Build.SourceVersion) > package/version.csv
displayName: Capture build version in package/version.csv
- task: NodeTool@0
displayName: 'Use nodejs 18.x'
inputs:
@ -51,28 +50,29 @@ steps:
customCommand: run set-git-authn -- --repoToken $(GITHUB_TOKEN)
- task: Npm@1
displayName: 'set version via npm'
displayName: 'increment version'
inputs:
command: custom
customCommand: run increment-version-npm
customCommand: run increment-version
# - task: Npm@1
# displayName: 'increment version'
# inputs:
# command: custom
# customCommand: run increment-version
- task: PowerShell@2
displayName: 'Record build version'
inputs:
targetType: 'inline'
script: |
$version = npm pkg get version
# Set the ADO Build number
Write-Host "##vso[build.updatebuildnumber]$version"
mkdir package
echo $version,$(Build.SourceVersion) > package/version.csv
- task: Npm@1
displayName: 'Official Build and Package VSIX'
displayName: 'Build and Package VSIX'
inputs:
command: custom
customCommand: run dist -- --feedPAT $(AZ_DevOps_Read_PAT) --isOfficialBuild true
- task: Npm@1
displayName: 'Preview Build and Package VSIX'
inputs:
command: custom
customCommand: run dist -- --feedPAT $(AZ_DevOps_Read_PAT) --isPreviewBuild true
customCommand: run dist -- --feedPAT $(AZ_DevOps_Read_PAT) --isOfficialBuild true --isPreviewBuild ${{ parameter.isPreRelease }}
# https://microsoft.sharepoint.com/teams/prss/esrp/info/ESRP%20Onboarding%20Wiki/Generating%20Signing%20JSON.aspx
# https://microsoft.sharepoint.com/teams/prss/esrp/info/ESRP%20Onboarding%20Wiki/Selecting%20CodeSign%20Certificates.aspx

34
.release-it.yaml Normal file
Просмотреть файл

@ -0,0 +1,34 @@
# https://github.com/release-it/release-it/blob/master/config/release-it.json
hooks: {}
# https://github.com/release-it/release-it/blob/master/docs/git.md
git:
addUntrackedFiles: false
commit: false
push: false # ADO build pushes the tag when build is complete, and fails if it's already there
# need to specify pushRepo, since AzDO insists on disconnected refs, breaking upstream
requireUpstream: false
pushArgs: [ '--tags' ]
pushRepo: https://github.com/microsoft/powerplatform-vscode
# requireBranch: main
requireCommits: false
requireCleanWorkingDir: false
tag: true
tagArgs: [ '--force' ]
tagAnnotation: |
build ${version}:
${changelog}
tagName: 'v${version}'
getLatestTagFromAllRefs: true
#https://github.com/release-it/release-it/blob/master/docs/npm.md
npm:
ignoreVersion: true
publish: false
# https://github.com/release-it/release-it/blob/master/docs/github-releases.md
github:
draft: true
release: false

Просмотреть файл

@ -54,7 +54,7 @@ async function clean() {
}
function setTelemetryTarget() {
const telemetryConfigurationSource = isOfficialBuild && !isPreviewBuild
const telemetryConfigurationSource = isOfficialBuild
? 'src/common/telemetry/telemetryConfigurationProd.ts'
: 'src/common/telemetry/telemetryConfigurationDev.ts';
@ -254,45 +254,11 @@ const testDesktopIntegration = gulp.series(compileIntegrationTests, async () =>
const testDesktopInt = gulp.series(testDesktopIntegration);
async function packageVsix() {
const standardHeader = '# Power Platform Extension';
const previewHeader = '# Power Platform Tools [PREVIEW]\n\n## This extension is used for internal testing against targets such as vscode.dev which require Marketplace published extensions, and is not supported.';
const standardPackageOptions = {
name: 'powerplatform-vscode',
displayName: 'Power Platform Tools',
description: 'Tooling to create Power Platform solutions & packages, manage Power Platform environments and edit Power Apps Portals',
readmeHeader: standardHeader,
readmeReplacementTarget: previewHeader,
};
const previewPackageOptions = {
name: 'powerplatform-vscode-preview',
displayName: 'Power Platform Tools [PREVIEW]',
description: 'Unsupported extension for testing Power Platform Tools',
readmeHeader: previewHeader,
readmeReplacementTarget: standardHeader,
};
const setPackageInfo = async function(pkgOptions) {
await npm(['pkg', 'set', `name=${pkgOptions.name}`]);
await npm(['pkg', 'set', `displayName="${pkgOptions.displayName}"`]);
await npm(['pkg', 'set', `description="${pkgOptions.description}"`]);
gulp.src('README.md')
.pipe(replace(pkgOptions.readmeReplacementTarget, pkgOptions.readmeHeader))
.pipe(gulp.dest('./'));
}
await setPackageInfo(isPreviewBuild ? previewPackageOptions : standardPackageOptions);
fs.ensureDirSync(packagedir);
await vsce.createVSIX({
packagePath: packagedir,
preRelease: isPreviewBuild,
});
// Reset to non-preview settings to prevent polluting git diffs
if (isPreviewBuild) {
await setPackageInfo(standardPackageOptions);
}
}
async function git(args) {
@ -301,12 +267,6 @@ async function git(args) {
return { stdout: stdout, stderr: stderr };
}
async function npm(args) {
args.unshift('npm');
const {stdout, stderr } = await exec(args.join(' '));
return {stdout: stdout, stderr: stderr};
}
async function npx(args) {
args.unshift('npx');
const {stdout, stderr } = await exec(args.join(' '));

3494
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -13,6 +13,7 @@
"translations-import": "node node_modules/gulp/bin/gulp.js translationsImport",
"set-git-authn": "node node_modules/gulp/bin/gulp.js setGitAuthN",
"increment-version-npm": "npm --no-git-tag-version version %VSIX_VERSION%",
"increment-version": "node node_modules/release-it/bin/release-it --increment patch --ci -VV",
"compile-web": "webpack",
"watch-web": "webpack --watch",
"run-in-browser": "vscode-test-web --browserType=chromium --extensionDevelopmentPath=. .",
@ -1015,6 +1016,7 @@
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"ps-list": "^7.2.0",
"release-it": "^16.2.1",
"sinon": "^14.0.0",
"stream-browserify": "^3.0.0",
"ts-loader": "^9.2.8",