Skip to content

Commit 15e10fa

Browse files
committed
fix: Including WinAppSDK in random facts package
1 parent bb01142 commit 15e10fa

File tree

3 files changed

+27
-23
lines changed

3 files changed

+27
-23
lines changed

.github/workflows/release-facts.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/CmdPalRandomFactsExtension/CmdPalRandomFactsExtension.csproj

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

1717
<Nullable>enable</Nullable>
18+
<WinAppSdkSelfContained>true</WinAppSdkSelfContained>
19+
1820
</PropertyGroup>
1921

2022
<ItemGroup>

src/CmdPalRandomFactsExtension/FactsPage.cs

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

36-
this.Commands = [_refreshContextMenuItem];
36+
Commands = [_refreshContextMenuItem, _copyContextMenuItem];
3737
}
3838

3939
public override IContent[] GetContent()
@@ -56,13 +56,13 @@ public void RefreshFact()
5656
if (string.IsNullOrEmpty(currentFact))
5757
{
5858
_copyContextCommand.Text = string.Empty;
59-
this.Commands = [_refreshContextMenuItem];
59+
Commands = [_refreshContextMenuItem];
6060
markdown = GenerateMarkdown("Awe snap! We couldn't load a fact.");
6161
}
6262
else
6363
{
6464
_copyContextCommand.Text = currentFact;
65-
this.Commands = [_refreshContextMenuItem, _copyContextMenuItem];
65+
Commands = [_refreshContextMenuItem, _copyContextMenuItem];
6666
markdown = GenerateMarkdown(currentFact);
6767
}
6868

0 commit comments

Comments
 (0)