-
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (53 loc) · 1.94 KB
/
update_publish.yml
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
name: Update And Publish Chocolatey Package
on:
workflow_dispatch:
schedule:
- cron: "0 9 * * *"
jobs:
check-update:
name: Check update
runs-on: windows-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
token: ${{ secrets.UPDATER }}
- name: Install au
shell: pwsh
run: Install-Module au -Force
- name: Check for new update
shell: pwsh
run: |
cd .\flow-launcher\
.\update.ps1
- name: Publish & commit new update
env:
API_KEY: ${{ secrets.PUBLISH }}
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
git diff --exit-code
if ($LastExitCode -eq 1)
{
cd .\flow-launcher\
echo "`nNew update exists"
echo "`nPublishing new update to Chocolatey"
$api_key = $Env:api_key
$push_url = 'https://push.chocolatey.org'
$packages = Get-ChildItem *.nupkg | Sort-Object -Property CreationTime -Descending
if (!$All) { $packages = $packages | Select-Object -First 1 }
if (!$packages) { throw 'There is no nupkg file in the directory'}
$packages | ForEach-Object { choco push $_.Name --api-key $api_key --source $push_url }
echo "`nCommiting to Git"
git config --global user.email "[email protected]"
git config --global user.name "choco_package_updater"
git add .\flow-launcher.nuspec
git add .\tools\chocolateyinstall.ps1
git commit -m 'new chocolatey package update'
git push
}elseif ($LastExitCode -eq 0)
{
echo "`nNo new updates"
}
- name: Keep cron job alive during inactivity
uses: gautamkrishnar/keepalive-workflow@v1