Skip to content

Commit bb01142

Browse files
committed
fix: Including WinAppSDK in dad jokes package
1 parent 2813a0e commit bb01142

File tree

3 files changed

+26
-23
lines changed

3 files changed

+26
-23
lines changed

.github/workflows/release-dadjokes.yml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,25 +91,27 @@ jobs:
9191
allowUpdates: true
9292
tag: ${{ github.ref_name }}
9393

94-
# publish:
95-
# runs-on: windows-latest
96-
# needs: build_sign_release
97-
# permissions:
98-
# packages: write
99-
# contents: write
100-
# steps:
101-
# - name: Submit extensions to Winget
102-
# run: |
103-
# $wingetPackage = "MichaelJolley.CmdPalRandomDadJokeExtension"
104-
# $gitToken = $Env:GITHUB_TOKEN
94+
publish:
95+
runs-on: windows-latest
96+
needs: build_sign_release
97+
permissions:
98+
packages: write
99+
contents: write
100+
steps:
101+
- name: Submit extensions to Winget
102+
run: |
103+
$wingetPackage = $Env:packageName
104+
$gitToken = $Env:GITHUB_TOKEN
105+
$tagPrefix = "^$Env:tag_prefix"
106+
107+
$github = Invoke-RestMethod -uri "https://api.github.com/repos/michaeljolley/CmdPalExtensions/releases"
108+
$targetRelease = $github | Where-Object -Property name -match $tagPrefix| Select -First 1
109+
110+
$installerArmUrl = $targetRelease.assets | Where-Object { $_.name -match 'ARM64' } | Select-Object -ExpandProperty browser_download_url
111+
$installerX64Url = $targetRelease.assets | Where-Object { $_.name -match 'x64' } | Select-Object -ExpandProperty browser_download_url
105112
106-
# $github = Invoke-RestMethod -uri "https://api.github.com/repos/michaeljolley/CmdPalExtensions/releases"
107-
# $targetRelease = $github | Where-Object -Property name -match 'Release'| Select -First 1
108-
# _0.0.4.0_x64.msix
109-
# $installerX64Url = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'CmdPalRandomDadJokeExtension*x64' | Select -ExpandProperty browser_download_url
110-
# # $installerArmUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'CmdPalRandomDadJokeExtension*arm64' | Select -ExpandProperty browser_download_url
111-
# $ver = $targetRelease.tag_name -ireplace '^v'
113+
$ver = $targetRelease.tag_name -ireplace $tagPrefix
112114
113-
# # getting latest wingetcreate file
114-
# iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
115-
# .\wingetcreate.exe update $wingetPackage -s -v $ver -u "$installerX64Url|machine" -t $gitToken
115+
# getting latest wingetcreate file
116+
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
117+
.\wingetcreate.exe update $wingetPackage -s -v $ver -u "$installerX64Url|machine" -v $ver -u "$installerArmUrl|machine" -t $gitToken

src/CmdPalRandomDadJokeExtension/CmdPalRandomDadJokeExtension.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<PublishProfile>Properties/PublishProfiles/win-$(Platform).pubxml</PublishProfile>
1616

1717
<Nullable>enable</Nullable>
18+
<WinAppSdkSelfContained>true</WinAppSdkSelfContained>
1819
</PropertyGroup>
1920

2021
<ItemGroup>

src/CmdPalRandomDadJokeExtension/DadJokePage.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public DadJokePage()
3434
_refreshCommand.RefreshRequested += HandleRefresh;
3535
_refreshContextMenuItem = new CommandContextItem(_refreshCommand);
3636

37-
this.Commands = [_refreshContextMenuItem];
37+
Commands = [_refreshContextMenuItem, _copyContextMenuItem];
3838
}
3939

4040
public override IContent[] GetContent()
@@ -57,13 +57,13 @@ public void RefreshJoke()
5757
if (string.IsNullOrEmpty(currentJoke))
5858
{
5959
_copyContextCommand.Text = string.Empty;
60-
this.Commands = [_refreshContextMenuItem];
60+
Commands = [_refreshContextMenuItem];
6161
markdown = GenerateMarkdown("Awe snap! We couldn't load a joke.");
6262
}
6363
else
6464
{
6565
_copyContextCommand.Text = currentJoke;
66-
this.Commands = [_refreshContextMenuItem, _copyContextMenuItem];
66+
Commands = [_refreshContextMenuItem, _copyContextMenuItem];
6767
markdown = GenerateMarkdown(currentJoke);
6868
}
6969

0 commit comments

Comments
 (0)