Package and Sign Notepad++ from Winget #14
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: Package and Sign Notepad++ from Winget | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
download_and_prepare: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
- name: Install winget | ||
uses: Cyberboss/install-winget@v1 | ||
- name: Start Package Inspector to Monitor Changes | ||
run: | | ||
# Start Package Inspector on drive C: to capture changes | ||
PackageInspector.exe Start C: | ||
shell: powershell | ||
- name: Download Notepad++ Installer with Winget | ||
id: download_installer | ||
run: | | ||
# Download installer and capture the output to find actual file path | ||
$downloadDir = "C:\actions\workspace" | ||
$wingetOutput = winget download -e --id Notepad++.Notepad++ --disable-interactivity --accept-source-agreements --download-directory $downloadDir | Out-String | ||
Write-Output $wingetOutput | ||
# Extract installer file path from the output | ||
if ($wingetOutput -match "Installer downloaded: (.+\.exe)") { | ||
$installerPath = $matches[1].Trim() | ||
Write-Output "Installer path found: $installerPath" | ||
echo "installer_path=$installerPath" >> "$GITHUB_ENV" | ||
} else { | ||
Write-Error "Installer file path not found in winget output." | ||
} | ||
shell: powershell | ||
- name: Parse YAML for Silent Switch | ||
id: parse_yaml | ||
run: | | ||
$yamlFile = Get-ChildItem -Path "C:\actions\workspace" -Filter *.yaml | Select-Object -First 1 | ||
if ($yamlFile) { | ||
$silentSwitch = "" | ||
$lines = Get-Content -Path $yamlFile.FullName | ||
# Parse lines manually to extract Silent switch | ||
foreach ($line in $lines) { | ||
if ($line -match "Silent:\s*(.+)") { | ||
$silentSwitch = $matches[1].Trim() | ||
} | ||
} | ||
# Set silent switch in environment variable | ||
echo "silent_switch=$silentSwitch" >> "$GITHUB_ENV" | ||
} else { | ||
Write-Error "YAML manifest file not found." | ||
} | ||
shell: powershell | ||
- name: Install Notepad++ with Logging | ||
run: | | ||
Check failure on line 64 in .github/workflows/notepad++.yml GitHub Actions / Package and Sign Notepad++ from WingetInvalid workflow file
|
||
# Log environment variables for debugging | ||
Write-Output "Installer Path: ${{ installer_path }}" | ||
Write-Output "Silent Switch: ${{ silent_switch }}" | ||
$installerPath = "${{ installer_path }}" | ||
$silentSwitch = "${{ silent_switch }}" | ||
$logFile = "C:\actions\workspace\install_log.txt" | ||
if ($installerPath -and $silentSwitch) { | ||
Start-Process -FilePath $installerPath -ArgumentList "$silentSwitch /LOG=$logFile" -Wait | ||
} else { | ||
Write-Error "Installer path or silent switch is not set." | ||
} | ||
shell: powershell | ||
- name: Stop Package Inspector and Generate CAT/CDF Files | ||
run: | | ||
$outputPath = "C:\actions\workspace" | ||
$catFileName = Join-Path -Path $outputPath -ChildPath "NPP.cat" | ||
$cdfFileName = Join-Path -Path $outputPath -ChildPath "NPP.cdf" | ||
# Stop Package Inspector to capture changes in a CAT file | ||
PackageInspector.exe Stop C: -Name $catFileName -cdfpath $cdfFileName | ||
shell: powershell | ||
- name: Upload CAT File and Installer to GitHub | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifacts | ||
path: | | ||
C:\actions\workspace\NPP.cat | ||
C:\actions\workspace\NPP.cdf | ||
${{ installer_path }} |