Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
majkinetor committed Sep 28, 2024
2 parents be8fed1 + 62307b5 commit 71d0984
Show file tree
Hide file tree
Showing 11 changed files with 429 additions and 196 deletions.
59 changes: 59 additions & 0 deletions .github/EventLogs.ps1
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 added .github/FUNDING.yml
Empty file.
72 changes: 72 additions & 0 deletions .github/workflows/package-pusher.yml
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
88 changes: 88 additions & 0 deletions .github/workflows/package-updater.yml
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
4 changes: 2 additions & 2 deletions fzf/fzf.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- Read this before publishing packages to chocolatey.org: https://github.com/chocolatey/chocolatey/wiki/CreatePackages -->
<id>fzf</id>
<title>A command-line fuzzy finder</title>
<version>0.53.0</version>
<version>0.55.0</version>
<authors>Junegunn Choi</authors>
<owners>Miodrag Milic</owners>
<summary>fzf is a general-purpose command-line fuzzy finder</summary>
Expand All @@ -26,7 +26,7 @@ fzf is a general-purpose command-line fuzzy finder.
<licenseUrl>https://raw.githubusercontent.com/junegunn/fzf-bin/master/LICENSE</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<iconUrl>https://cdn.rawgit.com/majkinetor/chocolatey/master/fzf/icon.png</iconUrl>
<releaseNotes>https://github.com/junegunn/fzf/releases/tag/0.53.0</releaseNotes>
<releaseNotes>https://github.com/junegunn/fzf/releases/tag/v0.55.0</releaseNotes>
<docsUrl>https://github.com/junegunn/fzf/blob/master/README.md</docsUrl>
<bugTrackerUrl>https://github.com/junegunn/fzf/issues</bugTrackerUrl>
<projectSourceUrl>https://github.com/junegunn/fzf</projectSourceUrl>
Expand Down
2 changes: 1 addition & 1 deletion fzf/update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function global:au_GetLatest {
$version = $url -split '/' | select -Last 1 -Skip 1

return @{
Version = $version
Version = $version.Substring(1)
URL32 = $url
ReleaseNotes = "$GitHubRepositoryUrl/releases/tag/$version"
}
Expand Down
Loading

0 comments on commit 71d0984

Please sign in to comment.