Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1d777c4

Browse files
authored
chore: move winget publish into release pipeline (#5728)
1 parent8ae28a3 commit1d777c4

File tree

2 files changed

+89
-60
lines changed

2 files changed

+89
-60
lines changed

‎.github/workflows/packages.yaml‎

Lines changed: 0 additions & 60 deletions
This file was deleted.

‎.github/workflows/release.yaml‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
env:
3737
# Necessary for Docker manifest
3838
DOCKER_CLI_EXPERIMENTAL:"enabled"
39+
outputs:
40+
version:${{ steps.version.outputs.version }}
3941
steps:
4042
-uses:actions/checkout@v3
4143
with:
@@ -49,6 +51,16 @@ jobs:
4951
-name:Fetch git tags
5052
run:git fetch --tags --force
5153

54+
-name:Print version
55+
id:version
56+
run:|
57+
set -euo pipefail
58+
version="$(./scripts/version.sh)"
59+
echo "version=$version" >> $GITHUB_OUTPUT
60+
# Speed up future version.sh calls.
61+
echo "CODER_FORCE_VERSION=$version" >> $GITHUB_ENV
62+
echo "$version"
63+
5264
-name:Create release notes
5365
env:
5466
# We always have to set this since there might be commits on
@@ -238,3 +250,80 @@ jobs:
238250
./build/*.deb
239251
./build/*.rpm
240252
retention-days:7
253+
254+
publish-winget:
255+
runs-on:windows-latest
256+
needs:release
257+
steps:
258+
-uses:actions/checkout@v3
259+
with:
260+
fetch-depth:0
261+
262+
# If the event that triggered the build was an annotated tag (which our
263+
# tags are supposed to be), actions/checkout has a bug where the tag in
264+
# question is only a lightweight tag and not a full annotated tag. This
265+
# command seems to fix it.
266+
# https://github.com/actions/checkout/issues/290
267+
-name:Fetch git tags
268+
run:git fetch --tags --force
269+
270+
-name:Install wingetcreate
271+
run:|
272+
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
273+
274+
-name:Submit updated manifest to winget-pkgs
275+
run:|
276+
# The package version is the same as the tag minus the leading "v".
277+
# The version in this output already has the leading "v" removed but
278+
# we do it again to be safe.
279+
$version = "${{ needs.release.outputs.version }}".Trim('v')
280+
281+
$release_assets = gh release view --repo coder/coder "v${version}" --json assets | `
282+
ConvertFrom-Json
283+
# Get the installer URL from the release assets.
284+
$installer_url = $release_assets.assets | `
285+
Where-Object name -Match ".*_windows_amd64_installer.exe$" | `
286+
Select -ExpandProperty url
287+
288+
echo "Installer URL: ${installer_url}"
289+
echo "Package version: ${version}"
290+
291+
# Bail if dry-run.
292+
if ($env:CODER_DRY_RUN -match "t") {
293+
echo "Skipping submission due to dry-run."
294+
exit 0
295+
}
296+
297+
# The URL "|X64" suffix forces the architecture as it cannot be
298+
# sniffed properly from the URL. wingetcreate checks both the URL and
299+
# binary magic bytes for the architecture and they need to both match,
300+
# but they only check for `x64`, `win64` and `_64` in the URL. Our URL
301+
# contains `amd64` which doesn't match sadly.
302+
#
303+
# wingetcreate will still do the binary magic bytes check, so if we
304+
# accidentally change the architecture of the installer, it will fail
305+
# submission.
306+
.\wingetcreate.exe update Coder.Coder `
307+
--submit `
308+
--version "${version}" `
309+
--urls "${installer_url}|X64" `
310+
--token "${{ secrets.CDRCI_GITHUB_TOKEN }}"
311+
312+
env:
313+
# For gh CLI:
314+
GH_TOKEN:${{ github.token }}
315+
316+
-name:Comment on PR
317+
run:|
318+
# Find the PR that wingetcreate just made.
319+
$version = "${{ needs.release.outputs.version }}".Trim('v')
320+
$pr_list = gh pr list --repo microsoft/winget-pkgs --search "author:cdrci Coder.Coder version ${version}" --limit 1 --json number | `
321+
ConvertFrom-Json`
322+
$pr_number = $pr_list[0].number
323+
324+
gh pr comment --repo microsoft/winget-pkgs "${pr_number}" --body "🤖 cc: @deansheather @matifali"
325+
326+
env:
327+
# For gh CLI. We need a real token since we're commenting on a PR in a
328+
# different repo.
329+
GH_TOKEN:${{ secrets.CDRCI_GITHUB_TOKEN }}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp