Skip to content

Create winget-submission.yml #3729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/winget-submission.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Submit package to Windows Package Manager Community Repository
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could just be called submit-packages.yml and "Submit packages" so we can use it for other package managers in the future


on:
release:
types: [published]

env:
version: "$(git describe --tags --abbrev=0)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency we should stick to ./scripts/version.sh. Also, instead of having an evaluated statement here (which doesn't get evaluated instantly), you should just have these be variables in the script instead.

packageFileName: coder_${version}_windows_amd64.zip
packageId: Coder.Coder # Most probably the id of coder package
Comment on lines +7 to +10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These env vars should be in UPPER_SNAKE_CASE format like normal env vars, and should be referenced by "$NAME" in the script below instead of using ${env:NAME} as they have different semantics


jobs:

winget:
name: Publish winget package
runs-on: windows-latest
steps:
- name: Submit package to Windows Package Manager Community Repository
run: |
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
$github = Get-Content '${{ github.event_path }}' | ConvertFrom-Json
$installerUrl = $github.release.assets | Where-Object -Property name -match ${env:packageFileName} | Select -ExpandProperty browser_download_url -First 1
.\wingetcreate.exe update ${env:packageId} -s -v $github.release.tag_name -u $installerUrl -t ${{ secrets.Project_PAT }}