Skip to content

Commit 84fe6eb

Browse files
authored
Merge pull request #1826 from docker/fix_winget_release
Refactor winget workflow to use wingetcreate CLI
2 parents 29aff84 + 68823fb commit 84fe6eb

1 file changed

Lines changed: 31 additions & 16 deletions

File tree

.github/workflows/winget.yml

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,41 @@ on:
55
workflow_dispatch:
66
inputs:
77
release_tag:
8-
description: 'Release tag to publish (e.g., v1.20.5)'
8+
description: "Release tag to publish (e.g., v1.20.5)"
99
required: true
1010
type: string
11-
permissions:
12-
contents: read
11+
dry_run:
12+
description: "Dry run (do not submit PR)"
13+
required: false
14+
type: boolean
15+
default: false
16+
17+
permissions: {}
18+
1319
jobs:
1420
publish:
1521
runs-on: windows-latest
1622
steps:
17-
- name: Generate app token
18-
uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1
19-
id: app-token
20-
with:
21-
app-id: ${{ vars.DOCKER_READ_APP_ID }}
22-
private-key: ${{ secrets.DOCKER_READ_APP_PRIVATE_KEY }}
23-
owner: ${{ github.repository_owner }}
23+
- name: publish
24+
env:
25+
WINGET_CREATE_GITHUB_TOKEN: ${{ secrets.WINGET_GH_TOKEN }}
26+
VERSION: ${{ inputs.release_tag || github.event.release.tag_name }}
27+
DRY_RUN: ${{ inputs.dry_run || false }}
28+
run: |
29+
winget install wingetcreate --accept-source-agreements --accept-package-agreements
30+
31+
$Version = $ENV:VERSION
32+
$DryRun = $ENV:DRY_RUN -eq 'true'
33+
$PackageId = "Docker.Cagent"
34+
$Urls = @(
35+
"https://github.com/docker/cagent/releases/download/$Version/cagent-windows-amd64.exe|amd64",
36+
"https://github.com/docker/cagent/releases/download/$Version/cagent-windows-arm64.exe|arm64"
37+
)
38+
39+
# Build command with conditional -s flag
40+
$params = @('update', $PackageId, '-v', $Version, '-u', $Urls)
41+
if (-not $DryRun) {
42+
$params += '-s'
43+
}
2444
25-
- name: Publish to WinGet
26-
uses: vedantmgoyal9/winget-releaser@19e706d4c9121098010096f9c495a70a7518b30f # v2
27-
with:
28-
identifier: "Docker.Cagent"
29-
version: "${{ github.event.release.tag_name || inputs.release_tag }}"
30-
token: ${{ steps.app-token.outputs.token }}
45+
& wingetcreate.exe @params

0 commit comments

Comments
 (0)