-
Notifications
You must be signed in to change notification settings - Fork 1
132 lines (114 loc) · 4.61 KB
/
updater.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Package Updater
on:
#push:
# branches: [master]
workflow_dispatch: # Enable manual trigger
inputs:
packages:
description: "What is the packages (optionally version) you wish to force update on?"
required: false
schedule:
- cron: "10 */8 * * *"
env:
# Set au version to use or omit to use the latest. Specify branch name to use development version from Github
au_version: master
au_push: true
# Use 1 to test all, or N to split testing into N groups
au_test_groups: 1
# Github token to commit pushed packages to repository
github_user_repo: ${{ github.repository }}
github_api_key: ${{ secrets.GITHUB_TOKEN }}
# Mail credentials - for error notifications
mail_user: ${{ secrets.MAIL_USER }}
mail_pass: ${{ secrets.MAIL_PASSWORD }}
mail_server: smtp.gmail.com
mail_port: 587
mail_enablessl: true
mail_attachments: '.\update_info.xml'
mail_userMessage: "[Force Test](https://gist.github.com/94c2ec0efd8f0d199af1ae9914bec446)"
#ID of the gist used to save run results
gist_id: 94c2ec0efd8f0d199af1ae9914bec446
#Chocolatey API key - to push updated packages
api_key: ${{ secrets.CHOCO_API_KEY }}
# GitHub Actions build url which points to this build
GH_ACTIONS_BUILD_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
nupkg_cache_path: C:\nupkg_cache
nuget_artifacts: ${{ github.runner.temp }}/artifacts
VT_APIKEY: ${{ secrets.VT_APIKEY }}
jobs:
updater:
runs-on: windows-2022
defaults:
run:
shell: powershell
steps:
- uses: actions/checkout@master
with:
fetch-depth: 100
- name: Configure git client
run: |
git config --global user.email "[email protected]"
git config --global user.name "Tunisiano"
git config --global core.safecrlf false
- name: Install Powershell Modules
env:
GH_SECRET: ${{ secrets.GITHUB_TOKEN }}
run: |
Install-Module -Name PowerShellForGitHub -Force
$secureString = ("$env:GH_SECRET" | ConvertTo-SecureString -AsPlainText -Force)
$cred = New-Object System.Management.Automation.PSCredential "username is ignored", $secureString
Set-GitHubAuthentication -Credential $cred
$secureString = $null # clear this out now that it's no longer needed
$cred = $null # clear this out now that it's no longer needed
Set-GitHubConfiguration -DisableTelemetry
- name: Install Dependencies
run: |
Set-Service wuauserv -StartupType Manual
choco install --no-progress wormies-au-helpers vt-cli -y
git clone -q https://github.com/chocolatey-community/chocolatey-au.git $Env:TEMP/au
. "$Env:TEMP/au/scripts/Install-AU.ps1" $Env:au_version
import-module "$(Get-Location)\scripts\au_extensions.psm1" -global
choco apikey --key ${{ secrets.CHOCO_API_KEY }} --source https://push.chocolatey.org/
- name: System information
run: |
Get-CimInstance win32_operatingsystem -Property Caption, OSArchitecture, Version | fl Caption, OSArchitecture, Version
$PSVersionTable
git --version
choco --version
cmd /c "set" | grep -i 'github\|runner' | sort
"Build info"
' {0,-20} {1}' -f 'SCHEDULED BUILD:', ("${{ github.event_name }}" -eq 'schedule')
' {0,-20} {1}' -f 'FORCED BUILD:' , ("${{ github.event_name }}" -eq 'workflow_dispatch')
- name: Run package updater
env:
FORCED_PACKAGES: ${{ github.event.inputs.packages }}
run: |
$Env:github_api_key = ${{ secrets.AU_GITHUB_API_KEY }}
. ./scripts/EventLogs.ps1
Clear-EventLogs
rm "$env:ChocolateyInstall\logs\*.log"
.\au\requisites.ps1
au/update_all.ps1 -ForcedPackages $env:FORCED_PACKAGES
git pull
git push origin master
Get-EventLogs * | ? Source -eq 'Schannel' | fl * | out-file eventlogs.txt
- name: Create diff file
run: |
git add automatic manual
git diff --cached > unsaved_changes.patch
- name: Create au temporary directory
run: |
if (Test-Path $Env:TEMP\chocolatey\au) { 7z a -mx9 au_temp.7z $Env:TEMP\chocolatey\au\* }
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@master
with:
name: artifacts
path: |
unsaved_changes.patch
au_temp.7z
update_info.xml
Update-AUPackages.md
eventlogs.txt
**/*.nupkg
retention-days: 5