Skip to content

Commit bae77d8

Browse files
committed
add winget publish workflow
1 parent 2547b6e commit bae77d8

File tree

2 files changed

+118
-0
lines changed

2 files changed

+118
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Publish Netbird to Winget
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Netbird version to publish (e.g., 0.59.7)'
10+
required: true
11+
type: string
12+
13+
jobs:
14+
publish-winget:
15+
runs-on: windows-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up WingetCreate
21+
run: |
22+
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
23+
24+
- name: Determine version
25+
id: version
26+
run: |
27+
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
28+
$version = "${{ github.event.inputs.version }}"
29+
} else {
30+
# Extract version from release tag (remove 'v' prefix if present)
31+
$version = "${{ github.event.release.tag_name }}".TrimStart('v')
32+
}
33+
echo "VERSION=$version" >> $env:GITHUB_ENV
34+
echo "version=$version" >> $env:GITHUB_OUTPUT
35+
36+
- name: Fetch release info
37+
id: release_info
38+
run: |
39+
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
40+
# For manual dispatch, fetch release info from GitHub API
41+
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/netbirdio/netbird/releases/tags/v${{ env.VERSION }}"
42+
} else {
43+
# For release event, use the current release
44+
$release = Invoke-RestMethod -Uri "${{ github.event.release.url }}"
45+
}
46+
47+
# Find MSI installer URL
48+
$installerUrl = $release.assets | Where-Object { $_.name -like "*windows_amd64.msi" } | Select-Object -ExpandProperty browser_download_url
49+
50+
if (-not $installerUrl) {
51+
Write-Error "No MSI installer found for version ${{ env.VERSION }}"
52+
exit 1
53+
}
54+
55+
echo "installer_url=$installerUrl" >> $env:GITHUB_OUTPUT
56+
echo "release_notes=$($release.body)" >> $env:GITHUB_OUTPUT
57+
58+
- name: Update Winget Manifest
59+
run: |
60+
Write-Host "Updating Winget manifest for Netbird version ${{ env.VERSION }}"
61+
Write-Host "Installer URL: ${{ steps.release_info.outputs.installer_url }}"
62+
63+
# Use wingetcreate to update and submit the manifest
64+
.\wingetcreate.exe update netbirdio.netbird `
65+
--version ${{ env.VERSION }} `
66+
--urls ${{ steps.release_info.outputs.installer_url }} `
67+
--submit `
68+
--token ${{ secrets.WINGET_PAT }} `
69+
--description "NetBird is an open-source VPN management platform built on WireGuard® making it easy to create secure private networks for your organization."
70+
71+
- name: Verify submission
72+
run: |
73+
if ($LASTEXITCODE -eq 0) {
74+
Write-Host "✅ Successfully submitted Winget manifest update for Netbird ${{ env.VERSION }}"
75+
} else {
76+
Write-Error "❌ Failed to submit Winget manifest update"
77+
exit 1
78+
}

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,43 @@ To uninstall NetBird, run the following command from the command line or PowerSh
2323
```
2424
choco uninstall netbird
2525
```
26+
27+
## Winget Package
28+
29+
This repository also includes automated workflows to publish NetBird to the Windows Package Manager (Winget) repository.
30+
31+
### Setup Requirements
32+
33+
To enable automatic Winget package publishing, you need to configure the following:
34+
35+
1. **GitHub Personal Access Token (PAT)**: Create a PAT with the `repo` scope to authenticate submissions to the Winget repository
36+
2. **Repository Secret**: Add the PAT as a repository secret named `WINGET_PAT`
37+
38+
### Workflow Triggers
39+
40+
The Winget publishing workflow (`publish-winget.yml`) is triggered by:
41+
- **Automatic**: When a new release is published in the NetBird repository
42+
- **Manual**: Via workflow dispatch with a specific version input
43+
44+
### How it Works
45+
46+
1. The workflow detects new NetBird releases
47+
2. Downloads the latest `wingetcreate` tool
48+
3. Extracts version information and MSI installer URL
49+
4. Uses `wingetcreate` to update the Winget manifest
50+
5. Automatically submits a pull request to the Windows Package Manager Community Repository
51+
52+
### Manual Publishing
53+
54+
You can manually trigger the Winget publishing workflow by:
55+
1. Going to the "Actions" tab in GitHub
56+
2. Selecting "Publish Netbird to Winget" workflow
57+
3. Clicking "Run workflow"
58+
4. Entering the desired NetBird version (e.g., `0.59.7`)
59+
60+
### Installation via Winget
61+
62+
Once published, users can install NetBird using:
63+
```
64+
winget install netbirdio.netbird
65+
```

0 commit comments

Comments
 (0)