Skip to content

Commit ecc180c

Browse files
authored
Merge pull request #97 from microsoft/alzollin/publishNpm
Added ESRPRelease task to publish npm package.
2 parents f52fd82 + ee6bac8 commit ecc180c

File tree

8 files changed

+377
-175
lines changed

8 files changed

+377
-175
lines changed

.pipelines/release.yml

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ parameters:
2424
akvName: $(SigningAKVName)
2525
authCertName: $(SigningAuthCertName)
2626
signCertName: $(SigningSignCertName)
27+
signTTSCertName: $(SigningSignTTSCertName)
2728

2829
extends:
2930
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
@@ -86,7 +87,7 @@ extends:
8687
Write-Host "##vso[task.setvariable variable=version;isOutput=true]$fullVersion"
8788
8889
- stage: Release
89-
displayName: Create GitHub Pre-release
90+
displayName: Create GitHub Release
9091
dependsOn: Build
9192
variables:
9293
version: $[ stageDependencies.Build.Build.outputs['SetMeta.version'] ]
@@ -97,7 +98,7 @@ extends:
9798
image: windows-latest
9899
os: windows
99100
hostArchitecture: amd64
100-
displayName: GitHub Pre-release
101+
displayName: GitHub Release
101102
templateContext:
102103
type: releaseJob
103104
isProduction: true
@@ -117,44 +118,48 @@ extends:
117118
inputs:
118119
rootFolderOrFile: $(Pipeline.Workspace)/cli-binaries/win-x64
119120
includeRootFolder: false
120-
archiveFile: $(Pipeline.Workspace)/winappcli-x64.zip
121+
archiveFile: $(Pipeline.Workspace)/winappcli-$(version)-x64.zip
121122

122123
- task: ArchiveFiles@2
123124
displayName: Archive CLI binaries - arm64
124125
inputs:
125126
rootFolderOrFile: $(Pipeline.Workspace)/cli-binaries/win-arm64
126127
includeRootFolder: false
127-
archiveFile: $(Pipeline.Workspace)/winappcli-arm64.zip
128+
archiveFile: $(Pipeline.Workspace)/winappcli-$(version)-arm64.zip
128129

129130
- task: GitHubRelease@1
130-
displayName: "Create GitHub Pre-release"
131+
displayName: "Create GitHub Release"
131132
inputs:
132133
gitHubConnection: 'github-service-connection'
133134
repositoryName: 'microsoft/winappcli'
134135
action: 'create'
135136
target: '$(Build.SourceVersion)'
136137
tagSource: 'userSpecifiedTag'
137138
tag: 'v$(version)'
138-
title: 'Pre-release v$(version)'
139+
title: 'Release v$(version)'
139140
isPreRelease: true
140141
assets: |
141-
$(Pipeline.Workspace)/winappcli-x64.zip
142-
$(Pipeline.Workspace)/winappcli-arm64.zip
142+
$(Pipeline.Workspace)/winappcli-*.zip
143143
$(Pipeline.Workspace)/msix-packages/*.msix
144144
$(Pipeline.Workspace)/npm-package/*.tgz
145145
assetUploadMode: 'delete'
146146
addChangeLog: false
147147
releaseNotesSource: 'inline'
148148
releaseNotesInline: |
149-
🚀 **Automated Pre-release Build**
149+
🚀 **Automated Release Build**
150150
151151
Version: `$(version)`
152152
Commit: `$(Build.SourceVersion)`
153153
154154
## Installation Options
155155
156+
### 📦 MSIX Installer (Recommended)
157+
1. Download `winappcli_$(version).0_x64.msix` for x64 or `winappcli_$(version).0_arm64.msix` for ARM64
158+
2. Double-click to install
159+
3. Automatically added to PATH
160+
156161
### 📦 Standalone CLI Binaries
157-
1. Download `winappcli-x64.zip` for x64 or `winappcli-arm64.zip` for ARM64
162+
1. Download `winappcli-$(version)-x64.zip` for x64 or `winappcli-$(version)-arm64.zip` for ARM64
158163
2. Extract to your desired location
159164
3. Add to PATH or run directly: `winapp.exe`
160165
@@ -164,5 +169,26 @@ extends:
164169
```
165170
166171
## What's Included
172+
- ✅ MSIX installer packages (x64 and ARM64)
167173
- ✅ Standalone CLI binaries (x64 and ARM64)
168-
- ✅ NPM package for NodeJS/Electron integration
174+
- ✅ NPM package for NodeJS/Electron integration
175+
176+
# Commented out ESRP release to npm for now
177+
# - ${{ if eq(parameters.DoEsrp, 'true') }}:
178+
# - task: EsrpRelease@10
179+
# inputs:
180+
# ConnectedServiceName: ${{ parameters.signingIdentity.serviceName }}
181+
# usemanagedidentity: true
182+
# keyvaultname: ${{ parameters.signingIdentity.akvName }}
183+
# signcertname: ${{ parameters.signingIdentity.signTTSCertName }}
184+
# clientid: ${{ parameters.signingIdentity.appId }}
185+
# intent: 'PackageDistribution'
186+
# contenttype: 'npm'
187+
# contentsource: 'Folder'
188+
# folderlocation: $(Pipeline.Workspace)/npm-package/
189+
# waitforreleasecompletion: true
190+
# owners: 'alzollin@microsoft.com'
191+
# approvers: 'alzollin@microsoft.com'
192+
# serviceendpointurl: 'https://api.esrp.microsoft.com'
193+
# mainpublisher: 'winappcli'
194+
# domaintenantid: ${{ parameters.signingIdentity.tenantId }}

.pipelines/templates/build.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ steps:
1515
inputs:
1616
pwsh: true
1717
filePath: $(System.DefaultWorkingDirectory)\scripts\build-cli.ps1
18-
arguments: "-Stable:$${{ parameters.stable }} -SkipMsix"
18+
arguments: "-Stable:$${{ parameters.stable }} -SkipNpm -SkipMsix"
1919
- ${{ if eq(parameters['DoEsrp'], 'true') }}:
2020
- task: EsrpCodeSigning@5
2121
displayName: Code Sign ESRP - CLI
@@ -55,6 +55,12 @@ steps:
5555
"ToolVersion": "1.0"
5656
}
5757
]
58+
- task: PowerShell@2
59+
displayName: Package NPM
60+
inputs:
61+
pwsh: true
62+
filePath: $(System.DefaultWorkingDirectory)\scripts\package-npm.ps1
63+
arguments: "-Stable:$${{ parameters.stable }}"
5864
- task: PowerShell@2
5965
displayName: Bundle MSIX Packages
6066
inputs:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ The easiest way to use the CLI is to download the latest build from GitHub Relea
4747

4848
| Package | Description | Use Case |
4949
|---------|-------------|----------|
50-
| **`winapp_[platform]-[version].msix`** | 📦 MSIX Installer | Easy to install, automatically added to path, great for general usage |
51-
| **`winappcli-[platform].zip`** | 📦 Standalone Binaries | Portable, no install needed - great for CI/CD |
50+
| **`winappcli_[version]_[platform].msix`** | 📦 MSIX Installer | Easy to install, automatically added to path, great for general usage |
51+
| **`winappcli-[version]-[platform].zip`** | 📦 Standalone Binaries | Portable, no install needed - great for CI/CD |
5252
| **`microsoft-winappcli-[version].tgz`** | 📚 NPM Package | For Node.js/Electron projects |
5353

5454
### Adding to Path

scripts/build-cli.ps1

Lines changed: 29 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
#!/usr/bin/env pwsh
22
<#
33
.SYNOPSIS
4-
Build script for Windows App Development CLI, npm package, and MSIX bundle
4+
Build script for Windows App Development CLI, npm package, and MSIX packages
55
.DESCRIPTION
66
This script builds the Windows App Development CLI for both x64 and arm64 architectures,
7-
creates the npm package, creates MSIX bundle with distribution package, and
7+
creates the npm package, creates MSIX packages with distribution package, and
88
places all artifacts in an artifacts folder. Run this script from the root of the project.
99
.PARAMETER SkipTests
1010
Skip running unit tests
1111
.PARAMETER FailOnTestFailure
1212
Exit with error code if tests fail (default: true, stops build on test failures)
13+
.PARAMETER SkipNpm
14+
Skip npm package creation
1315
.PARAMETER SkipMsix
14-
Skip MSIX bundle creation
16+
Skip MSIX packages creation
1517
.PARAMETER Stable
1618
Use stable build configuration (default: false, uses prerelease config)
1719
.EXAMPLE
1820
.\scripts\build-cli.ps1
1921
.EXAMPLE
2022
.\scripts\build-cli.ps1 -SkipTests
23+
.EXAMPLE
24+
.\scripts\build-cli.ps1 -SkipNpm
2125
.EXAMPLE
2226
.\scripts\build-cli.ps1 -SkipMsix
2327
.EXAMPLE
@@ -28,6 +32,7 @@ param(
2832
[switch]$Clean = $false,
2933
[switch]$SkipTests = $false,
3034
[switch]$FailOnTestFailure = $true,
35+
[switch]$SkipNpm = $false,
3136
[switch]$SkipMsix = $false,
3237
[switch]$Stable = $false
3338
)
@@ -42,7 +47,6 @@ try
4247
# Define paths
4348
$CliSolutionPath = "src\winapp-CLI\winapp.sln"
4449
$CliProjectPath = "src\winapp-CLI\WinApp.Cli\WinApp.Cli.csproj"
45-
$NpmProjectPath = "src\winapp-npm"
4650
$ArtifactsPath = "artifacts"
4751
$TestResultsPath = "TestResults"
4852

@@ -182,62 +186,29 @@ try
182186
exit 1
183187
}
184188

185-
# Step 6: Prepare npm package
186-
Write-Host "[NPM] Preparing npm package..." -ForegroundColor Blue
187-
188-
# Clean npm bin directory first
189-
Push-Location $NpmProjectPath
190-
npm run clean
191-
if ($LASTEXITCODE -ne 0) {
192-
Write-Warning "npm clean failed, continuing..."
193-
}
194-
195-
# Backup original package.json
196-
Write-Host "[NPM] Setting package version to $FullVersion..." -ForegroundColor Blue
197-
$PackageJsonPath = "package.json"
198-
Copy-Item $PackageJsonPath "$PackageJsonPath.backup" -Force
199-
200-
# Update package.json version temporarily
201-
$PackageJson = Get-Content $PackageJsonPath | ConvertFrom-Json
202-
$OriginalVersion = $PackageJson.version
203-
$PackageJson.version = $FullVersion
204-
$PackageJson | ConvertTo-Json -Depth 100 | Set-Content $PackageJsonPath
205-
206-
# Copy the CLI binaries we just built instead of rebuilding them
207-
Write-Host "[NPM] Copying CLI binaries to npm package..." -ForegroundColor Blue
208-
$NpmBinPath = "bin"
209-
New-Item -ItemType Directory -Path "$NpmBinPath\win-x64" -Force | Out-Null
210-
New-Item -ItemType Directory -Path "$NpmBinPath\win-arm64" -Force | Out-Null
211-
212-
# Copy from our artifacts to npm bin folders
213-
Copy-Item "$ProjectRoot\$ArtifactsPath\cli\win-x64\*" "$NpmBinPath\win-x64\" -Recurse -Force
214-
Copy-Item "$ProjectRoot\$ArtifactsPath\cli\win-arm64\*" "$NpmBinPath\win-arm64\" -Recurse -Force
215-
216-
Pop-Location
217-
218-
# Step 7: Create npm package tarball
219-
Write-Host "[PACK] Creating npm package tarball..." -ForegroundColor Blue
220-
Push-Location $NpmProjectPath
221-
npm pack --pack-destination "..\..\$ArtifactsPath"
222-
$PackResult = $LASTEXITCODE
189+
# Step 6: Create npm package (optional)
190+
if (-not $SkipNpm) {
191+
Write-Host ""
192+
Write-Host "[NPM] Creating npm package..." -ForegroundColor Blue
193+
194+
$PackageNpmScript = Join-Path $PSScriptRoot "package-npm.ps1"
223195

224-
# Restore original package.json
225-
Write-Host "[NPM] Restoring original package.json..." -ForegroundColor Blue
226-
if (Test-Path "$PackageJsonPath.backup") {
227-
Move-Item "$PackageJsonPath.backup" $PackageJsonPath -Force
228-
}
196+
& $PackageNpmScript -Version $FullVersion -Stable:$Stable
229197

230-
if ($PackResult -ne 0) {
231-
Write-Error "Failed to create npm package"
232-
Pop-Location
233-
exit 1
198+
if ($LASTEXITCODE -ne 0) {
199+
Write-Warning "npm package creation failed, but continuing..."
200+
} else {
201+
Write-Host "[NPM] npm package created successfully!" -ForegroundColor Green
202+
}
203+
} else {
204+
Write-Host ""
205+
Write-Host "[NPM] Skipping npm package creation (use -SkipNpm:`$false to enable)" -ForegroundColor Gray
234206
}
235-
Pop-Location
236207

237-
# Step 8: Create MSIX bundle (optional)
208+
# Step 7: Create MSIX packages (optional)
238209
if (-not $SkipMsix) {
239210
Write-Host ""
240-
Write-Host "[MSIX] Creating MSIX bundle..." -ForegroundColor Blue
211+
Write-Host "[MSIX] Creating MSIX packages..." -ForegroundColor Blue
241212

242213
# Convert npm version format to MSIX format
243214
if ($Stable) {
@@ -252,16 +223,16 @@ try
252223
$PackageMsixScript = Join-Path $PSScriptRoot "package-msix.ps1"
253224
$CliBinariesPath = Join-Path (Join-Path $ProjectRoot $ArtifactsPath) "cli"
254225

255-
& $PackageMsixScript -CliBinariesPath $CliBinariesPath -Version $MsixVersion -Stable $Stable
226+
& $PackageMsixScript -CliBinariesPath $CliBinariesPath -Version $MsixVersion -Stable:$Stable
256227

257228
if ($LASTEXITCODE -ne 0) {
258-
Write-Warning "MSIX bundle creation failed, but continuing..."
229+
Write-Warning "MSIX packages creation failed, but continuing..."
259230
} else {
260-
Write-Host "[MSIX] MSIX bundle created successfully!" -ForegroundColor Green
231+
Write-Host "[MSIX] MSIX packages created successfully!" -ForegroundColor Green
261232
}
262233
} else {
263234
Write-Host ""
264-
Write-Host "[MSIX] Skipping MSIX bundle creation (use -SkipMsix:`$false to enable)" -ForegroundColor Gray
235+
Write-Host "[MSIX] Skipping MSIX packages creation (use -SkipMsix:`$false to enable)" -ForegroundColor Gray
265236
}
266237

267238
# Build process complete - all artifacts are ready

scripts/msix-assets/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Windows Development CLI MSIX Installation
22

3-
This package contains a pre-release development build of the Windows Development CLI MSIX bundle.
3+
This package contains a pre-release development build of the Windows Development CLI MSIX packages.
44

5-
> **Note:** The MSIX bundle is signed with a dev certificate. This is temporary until we can sign with a proper certificate. Installing via the `install.cmd` script will install the dev certificate on your machine.
5+
> **Note:** The MSIX packages are signed with a dev certificate. This is temporary until we can sign with a proper certificate. Installing via the `install.cmd` script will install the dev certificate on your machine.
66
77
## Quick Installation
88

@@ -14,7 +14,8 @@ This package contains a pre-release development build of the Windows Development
1414
1515
## What's Included
1616

17-
- **winapp_[version].msixbundle** - The MSIX bundle with x64 and ARM64 packages
17+
- **winappcli_[version]_x64.msix** - The MSIX package for x64 architecture
18+
- **winappcli_[version]_arm64.msix** - The MSIX package for ARM64 architecture
1819
- **install.cmd** - Double-click installer (easiest method)
1920
- **install.ps1** - PowerShell installer script (alternative method)
2021

0 commit comments

Comments
 (0)