Package Updater #94
This file contains hidden or 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
| 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-2022 | |
| env: | |
| au_version: master | |
| au_push: true | |
| github_user_repo: ${{ github.repository }} | |
| github_api_key: ${{ secrets.GIST_API_KEY }} | |
| gist_id: df9d4f7d314e08279d949ba08f1ec769 | |
| 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: | |
| - uses: actions/checkout@v3.5.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure git client | |
| run: | | |
| git config --global user.email "riedel@teco.edu" | |
| git config --global user.name "till" | |
| git config --global core.safecrlf false | |
| - name: Install Dependencies | |
| run: | | |
| Set-Service wuauserv -StartupType Manual | |
| choco install -f --no-progress packages.config | |
| foreach ($module in (Import-PowerShellDataFile -Path requirements.psd1).RequiredModules) {Install-Module -Name $module -Force} | |
| 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 | |
| - 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: | | |
| Get-ChildItem -Path . -Directory | Where-Object { $_.Name -notmatch '^\.' } | Foreach { git add $_.Name } | |
| 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 |