Skip to content

Commit a7285fd

Browse files
authored
Merge pull request #4108 from headlamp-k8s/automate-chocolatey
github: Add action to push chocolatey automatically
2 parents ddad30a + 7302b43 commit a7285fd

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Push Chocolatey Package
2+
3+
# This action will run when a PR that updates the Chocolatey package is merged to main
4+
# It can also be triggered manually
5+
on:
6+
push:
7+
branches:
8+
- main
9+
paths:
10+
- 'app/windows/chocolatey/headlamp.nuspec'
11+
- 'app/windows/chocolatey/tools/chocolateyinstall.ps1'
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
push-chocolatey:
19+
runs-on: windows-latest
20+
steps:
21+
- name: Checkout Headlamp
22+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
23+
with:
24+
ref: main
25+
26+
- name: Install Chocolatey
27+
run: |
28+
Set-ExecutionPolicy Bypass -Scope Process -Force
29+
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
30+
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
31+
shell: powershell
32+
33+
- name: Pack Chocolatey Package
34+
run: |
35+
cd app/windows/chocolatey
36+
choco pack
37+
shell: powershell
38+
39+
- name: Push to Chocolatey
40+
run: |
41+
cd app/windows/chocolatey
42+
$nupkg = Get-ChildItem -Filter *.nupkg | Select-Object -First 1
43+
if ($nupkg) {
44+
Write-Host "Pushing package: $($nupkg.Name)"
45+
choco push $nupkg.FullName --source https://push.chocolatey.org/ --key ${{ secrets.CHOCOLATEY_API_KEY }}
46+
} else {
47+
Write-Error "No .nupkg file found"
48+
exit 1
49+
}
50+
shell: powershell

0 commit comments

Comments
 (0)