-
Notifications
You must be signed in to change notification settings - Fork 7
49 lines (39 loc) · 2.13 KB
/
Copy pathpublish.yml
File metadata and controls
49 lines (39 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Publish to package managers
on:
release:
types:
- published
workflow_dispatch:
jobs:
publish:
if: "!github.event.release.prerelease"
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Git
run: |
git clone https://github.com/tanchekwei/VisualStudioCodeForCommandPalette.git --depth 1
- name: Publish to Package Managers
run: |
$response = Invoke-RestMethod -Uri https://api.github.com/repos/tanchekwei/VisualStudioCodeForCommandPalette/releases/latest
$ver = $response.tag_name.TrimStart('v')
$exe = $response.assets | Where-Object { $_.name -like "*x64*" } | Select-Object -ExpandProperty browser_download_url
$exeARM = $response.assets | Where-Object { $_.name -like "*arm64*" } | Select-Object -ExpandProperty browser_download_url
Invoke-WebRequest -Uri $exe -OutFile .\x64.exe
Invoke-WebRequest -Uri $exeARM -OutFile .\arm.exe
$exehash = Get-FileHash -Path .\x64.exe -Algorithm SHA256 | Select-Object -ExpandProperty Hash
$exeARMhash = Get-FileHash -Path .\arm.exe -Algorithm SHA256 | Select-Object -ExpandProperty Hash
# Publish to Winget
$wingetPackage = "15722UsefulApp.WorkspaceLauncherForVSCode"
Invoke-WebRequest -Uri https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
cd .\VisualStudioCodeForCommandPalette\winget-pkg
Get-ChildItem *.* -Recurse | ForEach-Object {
(Get-Content $_.FullName) -replace '__VERSION__', "$ver" `
-replace '__URL__', "$exe" `
-replace '__SHA256__', "$exehash" `
-replace '__armURL__', "$exeARM" `
-replace '__armSHA256__', "$exeARMhash" |
Set-Content $_.FullName
}
echo "Publishing to winget..."
..\..\wingetcreate submit -p "New version: $wingetPackage version $ver" -t ${{ secrets.WINGETCREATE_GITHUB }} .