Skip to content
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

Create winget-publish.yml #6014

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
31 changes: 31 additions & 0 deletions .github/workflows/winget-pre-release-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: WinGet submission on pre-release
# based off of https://github.com/nushell/nushell/blob/main/.github/workflows/winget-submission.yml
# inspired by https://github.com/microsoft/PowerToys/blob/main/.github/workflows/package-submissions.yml
# Modified by @MerrickZ https://github.com/anpho

on:
workflow_dispatch:
release:
types: [prereleased]

jobs:
winget:
name: Publish winget package
runs-on: windows-latest
steps:
- name: Submit v2ray package to Windows Package Manager Community Repository
run: |

$wingetPackage = "2dust.v2rayN.Pre-release"
$gitToken = "${{ secrets.PT_WINGET }}"

$github = Invoke-RestMethod -uri "https://api.github.com/repos/2dust/v2rayN/releases"

$targetRelease = $github | Where-Object -Property prerelease -match 'True' | Select -First 1
$installerUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'v2rayN-windows-64-With-Core\.zip' | Select -ExpandProperty browser_download_url

$ver = $targetRelease.tag_name

# getting latest wingetcreate file
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
.\wingetcreate.exe update $wingetPackage -s -v $ver -u "$installerUrl|x64" -t $gitToken
31 changes: 31 additions & 0 deletions .github/workflows/winget-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: WinGet submission on release
# based off of https://github.com/nushell/nushell/blob/main/.github/workflows/winget-submission.yml
# inspired by https://github.com/microsoft/PowerToys/blob/main/.github/workflows/package-submissions.yml
# Modified by @MerrickZ https://github.com/anpho

on:
workflow_dispatch:
release:
types: [released]

jobs:
winget:
name: Publish winget package
runs-on: windows-latest
steps:
- name: Submit v2ray package to Windows Package Manager Community Repository
run: |

$wingetPackage = "2dust.v2rayN"
$gitToken = "${{ secrets.PT_WINGET }}"

$github = Invoke-RestMethod -uri "https://api.github.com/repos/2dust/v2rayN/releases"

$targetRelease = $github | Where-Object -Property prerelease -match 'False' | Select -First 1
$installerUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'v2rayN-With-Core\.zip*' | Select -ExpandProperty browser_download_url

$ver = $targetRelease.tag_name

# getting latest wingetcreate file
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
.\wingetcreate.exe update $wingetPackage -s -v $ver -u "$installerUrl|x64" -t $gitToken