Skip to content

Commit 0124289

Browse files
fix(ci): fix winget installer workflow (#5569)
* fix(ci): add GH_TOKEN env * chore: fix windows installer build filename Co-authored-by: Dean Sheather <dean@deansheather.com>
1 parent 04d45f3 commit 0124289

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

.github/workflows/packages.yaml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ jobs:
1515
run: |
1616
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
1717
18-
# the package version is the same as the release tag without the leading
19-
# "v", and with a trailing ".0" (e.g. "v1.2.3" -> "1.2.3.0")
18+
# The package version is the same as the tag minus the leading "v".
2019
- name: Calculate package version
2120
id: version
2221
run: |
2322
$version = $env:CODER_VERSION -replace "^v", ""
24-
$version += ".0"
2523
echo "::set-output name=version::$version"
2624
2725
- name: Submit updated manifest to winget-pkgs
@@ -35,17 +33,30 @@ jobs:
3533
3634
echo "Installer URL: $installer_url"
3735
36+
# The URL "|X64" suffix forces the architecture as it cannot be
37+
# sniffed properly from the URL. wingetcreate checks both the URL and
38+
# binary magic bytes for the architecture and they need to both match,
39+
# but they only check for `x64`, `win64` and `_64` in the URL. Our URL
40+
# contains `amd64` which doesn't match sadly.
41+
#
42+
# wingetcreate will still do the binary magic bytes check, so if we
43+
# accidentally change the architecture of the installer, it will fail
44+
# submission.
3845
.\wingetcreate.exe update Coder.Coder `
3946
--submit `
4047
--version "${{ steps.version.outputs.version }}" `
41-
--urls "$installer_url" `
48+
--urls "${installer_url}|X64" `
4249
--token "${{ secrets.CDRCI_GITHUB_TOKEN }}"
4350
51+
env:
52+
# For gh CLI:
53+
GH_TOKEN: ${{ github.token }}
54+
4455
- name: Comment on PR
4556
run: |
4657
# find the PR that wingetcreate just made
4758
$pr_list = gh pr list --repo microsoft/winget-pkgs --search "author:cdrci Coder.Coder version ${{ steps.version.outputs.version }}" --limit 1 --json number | `
4859
ConvertFrom-Json`
4960
$pr_number = $pr_list[0].number
5061
51-
gh pr comment --repo microsoft/winget-pkgs "$pr_number" --body "🤖 cc: @deansheather"
62+
gh pr comment --repo microsoft/winget-pkgs "$pr_number" --body "🤖 cc: @deansheather @matifali"

0 commit comments

Comments
 (0)