mirror of
https://github.com/coder/coder.git
synced 2026-06-06 22:48:19 +00:00
61 lines
2.2 KiB
YAML
61 lines
2.2 KiB
YAML
name: Submit Packages
|
|
on:
|
|
workflow_run:
|
|
workflows: [release]
|
|
types:
|
|
- completed
|
|
env:
|
|
CODER_VERSION: "${{ github.event.release.tag_name }}"
|
|
|
|
jobs:
|
|
winget:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Install wingetcreate
|
|
run: |
|
|
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
|
|
|
|
- name: Submit updated manifest to winget-pkgs
|
|
run: |
|
|
$release_assets = gh release view --repo coder/coder "$env:CODER_VERSION" --json assets | `
|
|
ConvertFrom-Json
|
|
# Get the installer URL from the release assets.
|
|
$installer_url = $release_assets.assets | `
|
|
Where-Object name -Match ".*_windows_amd64_installer.exe$" | `
|
|
Select -ExpandProperty url
|
|
|
|
echo "Installer URL: $installer_url"
|
|
|
|
# The package version is the same as the tag minus the leading "v".
|
|
$version = $env:CODER_VERSION.Trim('v')
|
|
|
|
echo "Package version: $version"
|
|
|
|
# The URL "|X64" suffix forces the architecture as it cannot be
|
|
# sniffed properly from the URL. wingetcreate checks both the URL and
|
|
# binary magic bytes for the architecture and they need to both match,
|
|
# but they only check for `x64`, `win64` and `_64` in the URL. Our URL
|
|
# contains `amd64` which doesn't match sadly.
|
|
#
|
|
# wingetcreate will still do the binary magic bytes check, so if we
|
|
# accidentally change the architecture of the installer, it will fail
|
|
# submission.
|
|
.\wingetcreate.exe update Coder.Coder `
|
|
--submit `
|
|
--version "${version}" `
|
|
--urls "${installer_url}|X64" `
|
|
--token "${{ secrets.CDRCI_GITHUB_TOKEN }}"
|
|
|
|
env:
|
|
# For gh CLI:
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
- name: Comment on PR
|
|
run: |
|
|
# find the PR that wingetcreate just made
|
|
$pr_list = gh pr list --repo microsoft/winget-pkgs --search "author:cdrci Coder.Coder version ${{ steps.version.outputs.version }}" --limit 1 --json number | `
|
|
ConvertFrom-Json`
|
|
$pr_number = $pr_list[0].number
|
|
|
|
gh pr comment --repo microsoft/winget-pkgs "$pr_number" --body "🤖 cc: @deansheather @matifali"
|