-
Notifications
You must be signed in to change notification settings - Fork 5
105 lines (90 loc) · 4.02 KB
/
Copy pathpublish-winget.yml
File metadata and controls
105 lines (90 loc) · 4.02 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Publish to winget
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 0.8.0)'
required: true
type: string
permissions:
contents: read
jobs:
publish-winget:
name: Publish to winget
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Get version
id: version
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ inputs.version }}"
else
VERSION="${GITHUB_REF#refs/tags/v}"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
- name: Download release asset
shell: pwsh
run: |
$VERSION = "${{ steps.version.outputs.version }}"
$TAG = "${{ steps.version.outputs.tag }}"
$ASSET = "a3s-box-$TAG-windows-x86_64.zip"
$URL = "https://github.com/$env:GITHUB_REPOSITORY/releases/download/$TAG/$ASSET"
Write-Host "Downloading: $URL"
Invoke-WebRequest -Uri $URL -OutFile $ASSET
# Compute SHA256
$SHA256 = (Get-FileHash -Path $ASSET -Algorithm SHA256).Hash
Write-Host "SHA256: $SHA256"
"sha256=$SHA256" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
id: download
- name: Update manifest files
shell: bash
run: |
VERSION="${{ steps.version.outputs.version }}"
TAG="${{ steps.version.outputs.tag }}"
SHA256="${{ steps.download.outputs.sha256 }}"
REPO="${GITHUB_REPOSITORY}"
# Update version in all manifest files
sed -i "s/PackageVersion: .*/PackageVersion: $VERSION/" .winget/A3SLab.Box.yaml
sed -i "s/PackageVersion: .*/PackageVersion: $VERSION/" .winget/A3SLab.Box.installer.yaml
sed -i "s/PackageVersion: .*/PackageVersion: $VERSION/" .winget/A3SLab.Box.locale.en-US.yaml
# Update installer URL and SHA256
sed -i "s|InstallerUrl: .*|InstallerUrl: https://github.com/${REPO}/releases/download/${TAG}/a3s-box-${TAG}-windows-x86_64.zip|" .winget/A3SLab.Box.installer.yaml
sed -i "s/InstallerSha256: .*/InstallerSha256: $SHA256/" .winget/A3SLab.Box.installer.yaml
# Update nested installer path
sed -i "s|RelativeFilePath: a3s-box-v[0-9.]*-windows-x86_64|RelativeFilePath: a3s-box-${TAG}-windows-x86_64|g" .winget/A3SLab.Box.installer.yaml
echo "Updated manifest files:"
cat .winget/A3SLab.Box.yaml
cat .winget/A3SLab.Box.installer.yaml
cat .winget/A3SLab.Box.locale.en-US.yaml
- name: Submit to winget-pkgs
uses: vedantmgoyal9/winget-releaser@main
with:
identifier: A3SLab.Box
version: ${{ steps.version.outputs.version }}
installers-regex: 'a3s-box-v.*-windows-x86_64\.zip$'
token: ${{ secrets.WINGET_TOKEN }}
fork-user: ${{ secrets.WINGET_FORK_USER }}
max-versions-to-keep: 5
# Alternative: Manual PR creation if vedantmgoyal9/winget-releaser doesn't work
- name: Create winget-pkgs PR (fallback)
if: failure()
shell: bash
run: |
VERSION="${{ steps.version.outputs.version }}"
echo "Automatic submission failed. Please manually submit to winget-pkgs:"
echo ""
echo "1. Fork https://github.com/microsoft/winget-pkgs"
echo "2. Create directory: manifests/a/A3SLab/Box/$VERSION/"
echo "3. Copy these files to that directory:"
echo " - .winget/A3SLab.Box.yaml"
echo " - .winget/A3SLab.Box.installer.yaml"
echo " - .winget/A3SLab.Box.locale.en-US.yaml"
echo "4. Create PR to microsoft/winget-pkgs"
echo ""
echo "Or use wingetcreate:"
echo "wingetcreate update A3SLab.Box -v $VERSION -u https://github.com/${GITHUB_REPOSITORY}/releases/download/v$VERSION/a3s-box-v$VERSION-windows-x86_64.zip -t ${{ secrets.GITHUB_TOKEN }}"