Skip to content

Commit 49091ee

Browse files
authored
Merge branch 'main' into copilot/add-custom-location-winapp
2 parents 5fa8ebf + 516407d commit 49091ee

File tree

5 files changed

+132
-84
lines changed

5 files changed

+132
-84
lines changed

.pipelines/release.yml

Lines changed: 113 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ resources:
1313

1414
parameters:
1515
- name: DoEsrp
16+
displayName: Sign the binaries and package (DoEsrp)
1617
type: boolean
1718
default: true
1819
- name: signingIdentity
@@ -25,6 +26,10 @@ parameters:
2526
authCertName: $(SigningAuthCertName)
2627
signCertName: $(SigningSignCertName)
2728
signTTSCertName: $(SigningSignTTSCertName)
29+
- name: GitHubReleaseAlreadyExists
30+
displayName: GitHub Release already exists, skip uploading GitHub release (GitHubReleaseAlreadyExists)
31+
type: boolean
32+
default: false
2833

2934
extends:
3035
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
@@ -128,91 +133,97 @@ extends:
128133
includeRootFolder: false
129134
archiveFile: $(Pipeline.Workspace)/winappcli-$(version)-arm64.zip
130135

131-
- task: GitHubRelease@1
132-
displayName: "Create GitHub Release"
133-
inputs:
134-
gitHubConnection: 'github-service-connection'
135-
repositoryName: 'microsoft/winappcli'
136-
action: 'create'
137-
target: '$(Build.SourceVersion)'
138-
tagSource: 'userSpecifiedTag'
139-
tag: 'v$(version)'
140-
title: 'Release v$(version)'
141-
isPreRelease: true
142-
assets: |
143-
$(Pipeline.Workspace)/winappcli-*.zip
144-
$(Pipeline.Workspace)/msix-packages/*.msix
145-
$(Pipeline.Workspace)/npm-package/*.tgz
146-
assetUploadMode: 'delete'
147-
addChangeLog: false
148-
releaseNotesSource: 'inline'
149-
releaseNotesInline: |
150-
🚀 **Automated Release Build**
136+
- ${{ if ne(parameters.GitHubReleaseAlreadyExists, 'true') }}:
137+
- task: GitHubRelease@1
138+
displayName: "Create GitHub Release"
139+
inputs:
140+
gitHubConnection: 'github-service-connection'
141+
repositoryName: 'microsoft/winappcli'
142+
action: 'create'
143+
target: '$(Build.SourceVersion)'
144+
tagSource: 'userSpecifiedTag'
145+
tag: 'v$(version)'
146+
title: 'Release v$(version)'
147+
isPreRelease: true
148+
assets: |
149+
$(Pipeline.Workspace)/winappcli-*.zip
150+
$(Pipeline.Workspace)/msix-packages/*.msix
151+
$(Pipeline.Workspace)/npm-package/*.tgz
152+
assetUploadMode: 'delete'
153+
addChangeLog: false
154+
releaseNotesSource: 'inline'
155+
releaseNotesInline: |
156+
🚀 **Automated Release Build**
151157
152-
Version: `$(version)`
153-
Commit: `$(Build.SourceVersion)`
158+
Version: `$(version)`
159+
Commit: `$(Build.SourceVersion)`
154160
155-
## Installation Options
161+
## Installation Options
156162
157-
### 📦 MSIX Installer (Recommended)
158-
1. Download `winappcli_$(version).0_x64.msix` for x64 or `winappcli_$(version).0_arm64.msix` for ARM64
159-
2. Double-click to install
160-
3. Automatically added to PATH
163+
### 📦 MSIX Installer (Recommended)
164+
1. Download `winappcli_$(version).0_x64.msix` for x64 or `winappcli_$(version).0_arm64.msix` for ARM64
165+
2. Double-click to install
166+
3. Automatically added to PATH
161167
162-
### 📦 Standalone CLI Binaries
163-
1. Download `winappcli-$(version)-x64.zip` for x64 or `winappcli-$(version)-arm64.zip` for ARM64
164-
2. Extract to your desired location
165-
3. Add to PATH or run directly: `winapp.exe`
168+
### 📦 Standalone CLI Binaries
169+
1. Download `winappcli-$(version)-x64.zip` for x64 or `winappcli-$(version)-arm64.zip` for ARM64
170+
2. Extract to your desired location
171+
3. Add to PATH or run directly: `winapp.exe`
166172
167-
### 📚 NPM Package (for Electron or NodeJS)
168-
```bash
169-
npm install microsoft-winappcli-$(version).tgz
170-
```
173+
### 📚 NPM Package (for Electron or NodeJS)
174+
```bash
175+
npm install microsoft-winappcli-$(version).tgz
176+
```
171177
172-
## What's Included
173-
- ✅ MSIX installer packages (x64 and ARM64)
174-
- ✅ Standalone CLI binaries (x64 and ARM64)
175-
- ✅ NPM package for NodeJS/Electron integration
178+
## What's Included
179+
- ✅ MSIX installer packages (x64 and ARM64)
180+
- ✅ Standalone CLI binaries (x64 and ARM64)
181+
- ✅ NPM package for NodeJS/Electron integration
176182
177-
# Commented out ESRP release to npm for now
178-
# - ${{ if eq(parameters.DoEsrp, 'true') }}:
179-
# - stage: Release_Npm
180-
# displayName: Create Npm Release
181-
# dependsOn: Release_GitHub
182-
# jobs:
183-
# - job: create_npm_release
184-
# pool:
185-
# name: Azure-Pipelines-1ESPT-ExDShared
186-
# image: windows-latest
187-
# os: windows
188-
# hostArchitecture: amd64
189-
# displayName: NPM Release
190-
# templateContext:
191-
# type: releaseJob
192-
# isProduction: true
193-
# inputs:
194-
# - input: pipelineArtifact
195-
# artifactName: npm-package
196-
# targetPath: $(Pipeline.Workspace)/npm-package
197-
# steps:
198-
# - task: EsrpRelease@10
199-
# condition: always()
200-
# inputs:
201-
# ConnectedServiceName: ${{ parameters.signingIdentity.serviceName }}
202-
# usemanagedidentity: true
203-
# keyvaultname: ${{ parameters.signingIdentity.akvName }}
204-
# signcertname: ${{ parameters.signingIdentity.signTTSCertName }}
205-
# clientid: ${{ parameters.signingIdentity.appId }}
206-
# intent: 'PackageDistribution'
207-
# contenttype: 'npm'
208-
# contentsource: 'Folder'
209-
# folderlocation: $(Pipeline.Workspace)/npm-package/
210-
# waitforreleasecompletion: true
211-
# owners: '$(EsrpOwnersEmail)'
212-
# approvers: '$(EsrpApproversEmail)'
213-
# serviceendpointurl: 'https://api.esrp.microsoft.com'
214-
# mainpublisher: 'winappcli'
215-
# domaintenantid: ${{ parameters.signingIdentity.tenantId }}
183+
- ${{ if eq(parameters.DoEsrp, 'true') }}:
184+
- stage: Release_Npm
185+
displayName: Create Npm Release
186+
dependsOn: Release_GitHub
187+
jobs:
188+
- job: create_npm_release
189+
pool:
190+
name: Azure-Pipelines-1ESPT-ExDShared
191+
image: windows-latest
192+
os: windows
193+
hostArchitecture: amd64
194+
displayName: NPM Release
195+
templateContext:
196+
type: releaseJob
197+
isProduction: true
198+
inputs:
199+
- input: pipelineArtifact
200+
artifactName: npm-package
201+
targetPath: $(Pipeline.Workspace)/npm-package
202+
steps:
203+
- task: PowerShell@2
204+
displayName: "Echo debug info"
205+
inputs:
206+
targetType: 'inline'
207+
script: |
208+
Write-Host "SigningServiceName: ${{ parameters.signingIdentity.serviceName }}"
209+
- task: EsrpRelease@10
210+
condition: always()
211+
inputs:
212+
ConnectedServiceName: ${{ parameters.signingIdentity.serviceName }}
213+
usemanagedidentity: true
214+
keyvaultname: ${{ parameters.signingIdentity.akvName }}
215+
signcertname: ${{ parameters.signingIdentity.signTTSCertName }}
216+
clientid: ${{ parameters.signingIdentity.appId }}
217+
intent: 'PackageDistribution'
218+
contenttype: 'npm'
219+
contentsource: 'Folder'
220+
folderlocation: $(Pipeline.Workspace)/npm-package/
221+
waitforreleasecompletion: true
222+
owners: '$(EsrpOwnersEmail)'
223+
approvers: '$(EsrpApproversEmail)'
224+
serviceendpointurl: 'https://api.esrp.microsoft.com'
225+
mainpublisher: 'ESRPRELPACMAN'
226+
domaintenantid: ${{ parameters.signingIdentity.tenantId }}
216227

217228
- stage: Release_WinGet
218229
displayName: Create WinGet Release
@@ -235,21 +246,43 @@ extends:
235246
displayName: "Publish to WinGet"
236247
env:
237248
# PAT lasts 90 days, regenerate as needed and re-run if it failes due to authentication
238-
WINGET_CREATE_GITHUB_TOKEN: $(GITHUB_TOKEN)
249+
WINGET_CREATE_GITHUB_TOKEN: $(GITHUB_TOKEN_2)
250+
GH_TOKEN: $(GITHUB_TOKEN_2)
239251
inputs:
240252
targetType: 'inline'
253+
errorActionPreference: 'stop'
241254
script: |
242255
# Download and install C++ Runtime framework package
243256
Write-Host "Installing VCLibs dependency..."
244257
$vcLibsFile = "Microsoft.VCLibs.x64.14.00.Desktop.appx"
245258
Invoke-WebRequest https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile $vcLibsFile
246259
Add-AppxPackage $vcLibsFile
247260
261+
# Install gh
262+
# TODO: Change this to get the latest version of gh
263+
Write-Host "Installing gh..."
264+
$tempDir = "$(Agent.TempDirectory)"
265+
Write-Host "TempDir: $tempDir"
266+
Invoke-WebRequest -Uri "https://github.com/cli/cli/releases/download/v2.83.1/gh_2.83.1_windows_amd64.zip" -OutFile "$tempdir\gh.zip"
267+
Expand-Archive "$tempdir\gh.zip" -DestinationPath "$tempDir\gh"
268+
248269
# Download and install wingetcreate
249270
Write-Host "Installing wingetcreate..."
250271
$wingetCreateBundle = "wingetcreate.msixbundle"
251272
Invoke-WebRequest https://aka.ms/wingetcreate/latest/msixbundle -OutFile $wingetCreateBundle
252273
Add-AppxPackage $wingetCreateBundle
274+
275+
# WinGetCreate uses an existing fork of the microsoft/winget-pkgs repo to create the PR
276+
# that updates the main repo. This fork will be under the account attached to the token.
277+
# We need to keep this fork up-to-date, otherwise the wingetcreate command will fail.
278+
# See: https://github.com/microsoft/winget-create/issues/502
279+
Write-Host "Syncing winget-pkgs fork..."
280+
& "$tempDir\gh\bin\gh.exe" repo sync $(WingetPkgsFork) -b master
281+
if ($LASTEXITCODE -ne 0) {
282+
Write-Error "Failed to sync winget-pkgs fork. Exit code: $LASTEXITCODE"
283+
exit $LASTEXITCODE
284+
}
285+
Write-Host "Fork synced successfully."
253286
254287
# Get the installer URLs from the GitHub release
255288
$x64MsixUrl = "https://github.com/microsoft/winappcli/releases/download/v$(version)/winappcli_$(version).0_x64.msix"
@@ -262,6 +295,6 @@ extends:
262295
263296
# Submit to WinGet repository
264297
wingetcreate update Microsoft.WinAppCli `
265-
--version $(version) `
298+
--version $(version) `
266299
--urls $x64MsixUrl $arm64MsixUrl `
267300
--submit

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ Perfect for:
4141

4242
## 📦 Installation
4343

44-
The easiest way to use the CLI is to download the latest build from GitHub Releases.
44+
### WinGet
45+
46+
The easiest way to use the CLI is via WinGet (Windows Package Manager). In Terminal, simply run:
47+
48+
`winget install Microsoft.WinAppCLI`
49+
50+
### Download Release Manually
51+
52+
Or, download the latest build from GitHub Releases:
4553

4654
**[👉 Download Latest Build](https://github.com/microsoft/WinAppCli/releases/latest)**
4755

@@ -55,7 +63,7 @@ The easiest way to use the CLI is to download the latest build from GitHub Relea
5563

5664
### Adding to Path
5765

58-
The easiest way to use the CLI globally is to install it via the [MSIX installer](https://github.com/microsoft/WinAppCli/releases/latest).
66+
The easiest way to use the CLI globally is to install it via WinGet or the [MSIX installer](https://github.com/microsoft/WinAppCli/releases/latest).
5967

6068
You can also add it manually: Windows Search → Edit the system environment variables → Environment Variables → Path → Edit → New → Add the location (folder) of winapp CLI.
6169

src/winapp-CLI/WinApp.Cli/Program.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ static async Task<int> Main(string[] args)
7676

7777
CommandCompletedEvent.Log(parseResult.CommandResult, returnCode);
7878

79+
if (args.Length == 0)
80+
{
81+
// Temporary special case: If no arguments are provided, return 0 to indicate success.
82+
// This is because winget's validation currently doesn't like us returning failure here.
83+
returnCode = 0;
84+
}
85+
7986
return returnCode;
8087
}
8188
catch (Exception ex)

src/winapp-CLI/WinApp.Cli/Telemetry/Events/EventBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class PrivacyProduct
1010
{
1111
public static readonly UInt16
1212
#pragma warning disable CA1707 // Identifiers should not contain underscores
13-
WIN_APP_DEV_CLI = 8;
13+
WIN_APP_DEV_CLI = 9;
1414
#pragma warning restore CA1707 // Identifiers should not contain underscores
1515
};
1616

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "0.1.5"
2+
"version": "0.1.8"
33
}

0 commit comments

Comments
 (0)