Skip to content

Package Updater

Package Updater #535

Workflow file for this run

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:
github_api_key: ${{ secrets.AU_GITHUB_API_KEY }}
FORCED_PACKAGES: ${{ github.event.inputs.packages }}
run: |
. ./scripts/EventLogs.ps1
New-Item -Path 'C:\Users\runneradmin\_netrc' -ItemType Directory
Clear-EventLogs
rm "$env:ChocolateyInstall\logs\*.log"
.\au\requisites.ps1
Write-Host "updating IconUrl in nuspec"
scripts/Update-IconUrl.ps1 -Quiet -GithubRepository "tunisiano187/Choco-packages" -UseStopwatch
au/update_all.ps1 -ForcedPackages $env:FORCED_PACKAGES
git pull
git commit -u -m "updated"
git push origin master
Get-EventLogs * | ? Source -eq 'Schannel' | fl * | out-file eventlogs.txt
- uses: actions/checkout@v4
- name: Create diff file
run: |
git add automatic
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