Skip to content

Update actions/checkout action to v4.2.2 (#175) #19

Update actions/checkout action to v4.2.2 (#175)

Update actions/checkout action to v4.2.2 (#175) #19

Workflow file for this run

name: Run Command
on:
push:
branches: [master]
workflow_dispatch: # Enable manual trigger
inputs:
packages:
description: List of packages to push (pkg1 ... pkgN)
required: true
jobs:
run-command:
name: Run Command
runs-on: windows-2022
concurrency: package_update
env:
# AU version to use or empty to use the latest. Specify branch name to use development version from GitHub
AU_VERSION:
AU_PUSH: true
# Repository containing packages
GITHUB_USER_REPO: pascalberger/chocolatey-packages
# ID of the gist used to save run results
GIST_ID: 95bd06a2adf814823623f01cf4a7f871
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0 # History plugin requires complete log
# Defines Git settings used for updating packages
- name: Initialize Git environment
shell: powershell
run: |
git config --global user.email "[email protected]"
git config --global user.name "Pascal Berger"
git config --global core.safecrlf false
# Show information about available environment
- name: Show environment information
shell: powershell
run: |
Get-CimInstance win32_operatingsystem -Property Caption, OSArchitecture, Version | Format-List Caption, OSArchitecture, Version
$PSVersionTable
git --version
choco --version
# Make Chocolatey Automatic Package Updater Module available
- name: Clone AU
shell: powershell
run: |
git clone -q https://github.com/majkinetor/au.git $Env:TEMP/au
. "$Env:TEMP/au/scripts/Install-AU.ps1" $Env:AU_VERSION
# Run specific commands which can be defined in commit messages
- name: Run commands
shell: powershell
run: |
if ( '${{ github.event_name }}' -eq 'push' )
{
switch -regex ('${{ github.event.head_commit.message }}')
{
'\[PUSH (.+?)\]' {
Write-Host "PUSH command found"
$packages = $Matches[1] -split ' '
}
default {
Write-Host "No command found"
}
}
}
elseif ( '${{ github.event_name }}' -eq 'workflow_dispatch' )
{
$packages = '${{ github.event.inputs.packages }}'
}
if ( $packages )
{
foreach ($package in $packages) {
Write-Host ("{0}`n{1}`n" -f ('-'*60), "PACKAGE: $package")
$package_dir = Get-ChildItem -recurse | Where-Object { $_.Name -eq "$package.nuspec"} | Select-Object -First 1 | ForEach-Object Directory
if (!$package_dir) { Write-Warning "Can't find package '$package'"; continue }
Push-Location $package_dir
if (Test-Path update.ps1 -ea 0) { ./update.ps1 }
choco pack; Push-Package -All;
Pop-Location
}
}
env:
api_key: ${{ secrets.CHOCOLATEY_API_KEY }}
github_api_key: ${{ secrets.GITHUBREPO_API_KEY }}