-
Notifications
You must be signed in to change notification settings - Fork 6
64 lines (55 loc) · 2.08 KB
/
update.yml
File metadata and controls
64 lines (55 loc) · 2.08 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
name: Choco Auto Update
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
defaults:
run:
shell: pwsh
jobs:
update_choco_auto:
name: update_${{ matrix.package }}
runs-on: windows-latest
strategy:
max-parallel: 1
matrix:
package: [
automatedlab,
powershelluniversal,
pgutil,
inedohub,
proget,
nexushell
]
steps:
- uses: actions/checkout@v4
with:
ref: master
- name: Install Chocolatey Automatic Package Updater Module
run: Install-Module -Name Chocolatey-AU -Force
- name: Run ${{ matrix.package }} update script
id: update
run: |
cd automatic\${{ matrix.package }}
$UpdateOutput = .\update.ps1
$NupkgPath = (($UpdateOutput.Result | Where-Object {$_ -like '*.nupkg''*'}) -split "'")[1]
Write-Output "NupkgPath=$($NupkgPath)" >> $Env:GITHUB_OUTPUT
$UpdateStatus = if ($UpdateOutput.Result -match 'No new version found') {'No Update'} else {'Update Available'}
Write-Output "UpdateStatus=$($UpdateStatus)" >> $Env:GITHUB_OUTPUT
- name: Test ${{ matrix.package }} install
run: Test-Package -Install -Nu ${{ steps.update.outputs.NupkgPath }}
if: steps.update.outputs.UpdateStatus == 'Update Available' && steps.update.outputs.NupkgPath != ''
continue-on-error: true
- name: Publish to Chocolatey community feed
run: |
$Nupkg = '${{ steps.update.outputs.NupkgPath }}'
$ApiKey = '${{ secrets.CHOCO_API_KEY }}'
$ChocoServer = 'https://push.chocolatey.org/'
choco push $Nupkg --source $ChocoServer --key $ApiKey
if: steps.update.outputs.UpdateStatus == 'Update Available'
- name: Commit Updated nuspec
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply Choco package update - ${{ matrix.package }} ${{ steps.update.outputs.newversion }}
file_pattern: '*.nuspec *.ps1'
if: steps.update.outputs.UpdateStatus == 'Update Available'