-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/majkinetor/au-packages
- Loading branch information
Showing
11 changed files
with
429 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#require -version 3.0 | ||
|
||
<# | ||
.SYNOPSIS | ||
Clear all event logs | ||
#> | ||
function Clear-EventLogs { | ||
Get-EventLog * | ForEach-Object { | ||
try { | ||
Clear-EventLog $_.Log | ||
} | ||
catch { | ||
Write-Warning 'Error during clearing event logs' | ||
Write-Warning "$_" | ||
} | ||
} | ||
|
||
#Clear this one again as it accumulates clearing events from previous step | ||
try { | ||
Clear-EventLog System | ||
} | ||
catch { | ||
Write-Warning 'Error during clearing event logs' | ||
Write-Warning "$_" | ||
} | ||
Get-EventLog * | ||
} | ||
|
||
<# | ||
.SYNOPSIS | ||
Get latest event logs across all event logs | ||
.Example | ||
logs Error,Warning -Newest 5 | ||
#> | ||
function Get-EventLogs { | ||
param( | ||
[ValidateSet('Error', 'Information', 'Warning', '*')] | ||
[string[]] $EntryType = 'Error', | ||
|
||
[int] $Newest = 1000, | ||
|
||
[switch] $Raw | ||
) | ||
$r = @() | ||
|
||
if ($EntryType -eq '*') { $EntryType = 'Error', 'Information', 'Warning' } | ||
Get-EventLog * | ForEach-Object Log | ForEach-Object { | ||
$log = $_ | ||
try { | ||
$r += Get-EventLog -Log $log -Newest $Newest -EntryType $EntryType -ea 0 | ||
} | ||
catch { Write-Warning "$log - $_" } | ||
} | ||
$r = $r | Sort-Object TimeWritten -Descending | ||
if ($Raw) { $r } else { $r | Select-Object Source, TimeWritten, Message } | ||
} | ||
|
||
Set-Alias logs Get-EventLogs | ||
Set-Alias clearlogs Clear-EventLogs |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Package Pusher | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
packages: | ||
description: "What is the packages you wish to push?" | ||
required: true | ||
|
||
jobs: | ||
pusher: | ||
runs-on: windows-2019 | ||
env: | ||
au_version: master | ||
github_user_repo: ${{ github.repository }} | ||
api_key: ${{ secrets.CHOCO_API_KEY }} | ||
|
||
steps: | ||
- name: Install Dependencies | ||
run: | | ||
Set-Service wuauserv -StartupType Manual | ||
choco install wormies-au-helpers vt-cli -y | ||
Install-Module Pester -RequiredVersion 4.10.1 -Scope CurrentUser -Force -SkipPublisherCheck | ||
git clone -q https://github.com/chocolatey-community/chocolatey-au.git $Env:TEMP/au | ||
. "$Env:TEMP/au/scripts/Install-AU.ps1" $Env:au_version | ||
shell: powershell | ||
- name: System information | ||
run: | | ||
Get-CimInstance win32_operatingsystem -Property Caption, OSArchitecture, Version | fl Caption, OSArchitecture, Version | ||
$PSVersionTable | ||
git --version | ||
choco --version | ||
"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') | ||
shell: powershell | ||
- uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
- name: Run package pushing | ||
env: | ||
PACKAGES_PUSHES: ${{ github.event.inputs.packages }} | ||
run: | | ||
$packages = $env:PACKAGES_PUSHES -split ' ' | ||
Write-Host "PUSHING PACKAGES: $packages" | ||
foreach ($package in $packages) { | ||
Write-Host ("{0}`n{1}`n" -f ('-'*60), "PACKAGE: $package") | ||
$package_dir = ls -recurse | ? { $_.Name -eq "$package.nuspec" } | select -First 1 | % Directory | ||
if (!$package_dir) { Write-Warning "Can't find package '$package'"; continue } | ||
pushd $package_dir | ||
if (Test-Path update.ps1 -ea 0) { ./update.ps1 } | ||
choco pack | ||
Push-Package | ||
popd | ||
} | ||
shell: powershell | ||
- name: Create diff file | ||
run: | | ||
git add automatic extension manual templates | ||
git diff --cached > unsaved_changes.patch | ||
shell: powershell | ||
- name: Upload artifacts | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifacts | ||
path: | | ||
unsaved_changes.patch | ||
eventlogs.txt | ||
**/*.nupkg | ||
retention-days: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: Package Updater | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
workflow_dispatch: | ||
inputs: | ||
packages: | ||
description: "What is the packages (optionally version) you wish to force update on?" | ||
required: false | ||
schedule: | ||
- cron: "0 3 * * *" | ||
|
||
jobs: | ||
updater: | ||
runs-on: windows-2019 | ||
env: | ||
au_version: master | ||
au_push: true | ||
github_user_repo: ${{ github.repository }} | ||
github_api_key: ${{ secrets.GIST_API_KEY }} | ||
gist_id: a700c70b8847b29ebb1c918d47ee4eb1 | ||
nupkg_cache_path: C:\nupkg_cache | ||
mail_user: ${{ secrets.MAIL_USER }} | ||
mail_pass: ${{ secrets.MAIL_PASSWORD }} | ||
mail_server: smtp.gmail.com | ||
mail_port: 587 | ||
mail_enablessl: true | ||
api_key: ${{ secrets.CHOCO_API_KEY }} | ||
nuget_artifacts: ${{ github.runner.temp }}/artifacts | ||
|
||
steps: | ||
- name: Configure git client | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Chocolatey" | ||
git config --global core.safecrlf false | ||
- name: Install Dependencies | ||
run: | | ||
Set-Service wuauserv -StartupType Manual | ||
git clone -q https://github.com/majkinetor/au.git $Env:TEMP/au | ||
. "$Env:TEMP/au/scripts/Install-AU.ps1" $Env:au_version | ||
shell: powershell | ||
- name: System information | ||
run: | | ||
Get-CimInstance win32_operatingsystem -Property Caption, OSArchitecture, Version | fl Caption, OSArchitecture, Version | ||
$PSVersionTable | ||
git --version | ||
choco --version | ||
"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') | ||
shell: powershell | ||
- uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
- name: Run package updater | ||
env: | ||
FORCED_PACKAGES: ${{ github.event.inputs.packages }} | ||
run: | | ||
. ./.github/EventLogs.ps1 | ||
Clear-EventLogs | ||
Remove-Item "$Env:ChocolateyInstall\logs\*.log" | ||
./update_all.ps1 -ForcedPackages $env:FORCED_PACKAGES | ||
Get-EventLogs * | ? Source -eq 'Schannel' | Format-List * | Out-File eventlogs.txt | ||
shell: powershell | ||
- name: Create diff file | ||
run: | | ||
git add automatic extension manual templates | ||
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\* } | ||
shell: powershell | ||
- name: Upload artifacts | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifacts | ||
path: | | ||
unsaved_changes.patch | ||
au_temp.7z | ||
update_info.xml | ||
Update-AUPackages.md | ||
eventlogs.txt | ||
**/*.nupkg | ||
retention-days: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.