Skip to content

Scheduled Certificate Update #21

Scheduled Certificate Update

Scheduled Certificate Update #21

name: Scheduled Certificate Update
on:
schedule:
- cron: '0 9 * * 0' # Runs every Sunday at 09:00
jobs:
review_certificates:
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Review Certificates
run: |
Get-ChildItem -Path Certificates\*.cer | ForEach-Object {
$cert = $_.FullName
$software_name = [System.IO.Path]::GetFileNameWithoutExtension($cert)
# Logic to download the latest version if the filename is different
$current_version = signtool verify /pa "$cert" | Select-String -Pattern "Version" | ForEach-Object { $_.ToString().Split(" ")[-1] } # Adjust as necessary
# Assuming you have logic to find the download link based on the software name
$download_link = "URL_FOR_$software_name" # Placeholder for actual download logic
Invoke-WebRequest -Uri $download_link -OutFile "${software_name}.exe"
$new_version = signtool verify /pa "${software_name}.exe" | Select-String -Pattern "Version" | ForEach-Object { $_.ToString().Split(" ")[-1] } # Adjust as necessary
if ($current_version -ne $new_version) {
Write-Host "Updating certificate for $software_name..."
signtool verify /pa "${software_name}.exe" > "Certificates/${software_name}.cer" # Adjust command as necessary
Add-Content README.md "Last checked on: $(Get-Date -Format 'yyyy-MM-dd')"
Add-Content README.md "Updated software: ${software_name} to version ${new_version}"
}
}
- name: Commit and Push Changes
run: |
git config --local user.name "github-actions"
git config --local user.email "action@github.com"
git add README.md
git commit -m "Update README.md with latest check date" || Write-Host "No changes to commit"
git push