@@ -18,6 +18,8 @@ permissions:
18
18
jobs :
19
19
release :
20
20
runs-on :${{ github.repository_owner == 'coder' && 'windows-latest-16-cores' || 'windows-latest' }}
21
+ outputs :
22
+ version :${{ steps.version.outputs.VERSION }}
21
23
timeout-minutes :15
22
24
23
25
steps :
@@ -117,3 +119,78 @@ jobs:
117
119
${{ steps.release.outputs.ARM64_OUTPUT_PATH }}
118
120
env :
119
121
GITHUB_TOKEN :${{ secrets.GITHUB_TOKEN }}
122
+
123
+ winget :
124
+ runs-on :depot-windows-latest
125
+ needs :release
126
+ steps :
127
+ -name :Sync fork
128
+ run :gh repo sync cdrci/winget-pkgs -b master
129
+ env :
130
+ GH_TOKEN :${{ secrets.CDRCI_GITHUB_TOKEN }}
131
+
132
+ -name :Checkout
133
+ uses :actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
134
+ with :
135
+ fetch-depth :0
136
+
137
+ # If the event that triggered the build was an annotated tag (which our
138
+ # tags are supposed to be), actions/checkout has a bug where the tag in
139
+ # question is only a lightweight tag and not a full annotated tag. This
140
+ # command seems to fix it.
141
+ # https://github.com/actions/checkout/issues/290
142
+ -name :Fetch git tags
143
+ run :git fetch --tags --force
144
+
145
+ -name :Install wingetcreate
146
+ run :|
147
+ Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
148
+
149
+ -name :Submit updated manifest to winget-pkgs
150
+ run :|
151
+ $version = "${{ needs.release.outputs.version }}"
152
+
153
+ $release_assets = gh release view --repo coder/coder-desktop-windows "v${version}" --json assets | `
154
+ ConvertFrom-Json
155
+ # Get the installer URLs from the release assets.
156
+ $amd64_installer_url = $release_assets.assets | `
157
+ Where-Object name -Match ".*-x64.exe$" | `
158
+ Select -ExpandProperty url
159
+ $arm64_installer_url = $release_assets.assets | `
160
+ Where-Object name -Match ".*-arm64.exe$" | `
161
+ Select -ExpandProperty url
162
+
163
+ echo "amd64 Installer URL: ${amd64_installer_url}"
164
+ echo "arm64 Installer URL: ${arm64_installer_url}"
165
+ echo "Package version: ${version}"
166
+
167
+ .\wingetcreate.exe update Coder.CoderDesktop `
168
+ --submit `
169
+ --version "${version}" `
170
+ --urls "${amd64_installer_url}" "${arm64_installer_url}" `
171
+ --token "$env:WINGET_GH_TOKEN"
172
+
173
+ env :
174
+ # For gh CLI:
175
+ GH_TOKEN :${{ github.token }}
176
+ # For wingetcreate. We need a real token since we're pushing a commit
177
+ # to GitHub and then making a PR in a different repo.
178
+ WINGET_GH_TOKEN :${{ secrets.CDRCI_GITHUB_TOKEN }}
179
+
180
+
181
+ -name :Comment on PR
182
+ run :|
183
+ # wait 30 seconds
184
+ Start-Sleep -Seconds 30.0
185
+ # Find the PR that wingetcreate just made.
186
+ $version = "${{ needs.release.outputs.version }}"
187
+ $pr_list = gh pr list --repo microsoft/winget-pkgs --search "author:cdrci Coder.CoderDesktop version ${version}" --limit 1 --json number | `
188
+ ConvertFrom-Json
189
+ $pr_number = $pr_list[0].number
190
+
191
+ gh pr comment --repo microsoft/winget-pkgs "${pr_number}" --body "🤖 cc: @deansheather @matifali"
192
+
193
+ env :
194
+ # For gh CLI. We need a real token since we're commenting on a PR in a
195
+ # different repo.
196
+ GH_TOKEN :${{ secrets.CDRCI_GITHUB_TOKEN }}