Auto Update chocolatey-community-packages #16353
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
name: Auto Update chocolatey-community-packages | |
on: | |
push: | |
branches: master | |
workflow_dispatch: # Enable manual trigger | |
inputs: | |
forced_packages: | |
description: The list of packages to forcibly update (like "pkg1:ver1 pkg2") | |
required: false | |
schedule: | |
- cron: '17 4-17 * * *' | |
jobs: | |
auto_update: | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: powershell | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 100 | |
- name: Check a build environment | |
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 | |
- name: Initialize Git config | |
env: | |
github_context: ${{ toJson(github) }} | |
run: | | |
$context = $ENV:github_context | ConvertFrom-JSON | |
git config --global user.email ($context.repository_owner + '[email protected]') | |
git config --global user.name $context.repository_owner | |
git config --global core.safecrlf false | |
- name: Install AU | |
env: | |
au_version: master | |
run: | | |
git clone -q https://github.com/ITS-Unibas/chocolatey-au $Env:TEMP/chocolatey-au | |
. "$Env:TEMP/chocolatey-au/scripts/Install-AU.ps1" $Env:au_version | |
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | |
Install-Module Wormies-AU-Helpers -Scope CurrentUser -Force | |
- name: Check update for packages & push changes | |
env: | |
au_push: true | |
#au_pushurl: https://www.myget.org/F/kai2nenobu # Where to push packages | |
# Github token to commit pushed packages to repository | |
github_user_repo: ${{ github.repository }} | |
github_api_key: ${{ secrets.GH_TOKEN }} | |
# Chocolatey API key - to push updated packages | |
api_key: ${{ secrets.CHOCO_TOKEN }} | |
run: | | |
$ErrorActionPreference = 'Continue' | |
# Update automatic packages | |
./update_all.ps1 -ForcedPackages '${{ github.event.inputs.forced_packages }}' | |
# Renew README.md | |
Remove-Item -Path .\README.md | |
Rename-Item -Path .\Update-AUPackages.md -NewName README.md | |
# Push changes | |
git add . | |
git commit -m "updated chocolatey-community-packages" | |
git push |