Skip to content

Testing the build procedures on Windows #52

Testing the build procedures on Windows

Testing the build procedures on Windows #52

name: Build on Windows
run-name: Testing the build procedures on Windows
on:
workflow_dispatch:
workflow_run:
workflows: ["Auto Update and Release"]
types:
- completed
jobs:
build:
runs-on: windows-latest
steps:
- name: Check for new release
env:
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
shell: pwsh
run: |
try{
$last_release = Invoke-RestMethod -Uri "https://api.github.com/repos/${Env:GIT_USER_NAME}/JetBrainsMonoNerdFonts/releases"
$last_release_time = [System.DateTime]::Parse($last_release.created_at)
Write-Host "Last release time: $($last_release_time.ToString("yyyy-MM-dd HH:mm:ss"))"
$current_time = Get-Date
Write-Host "Current time: $($current_time.ToString("yyyy-MM-dd HH:mm:ss"))"
$time_difference = ($current_time - $last_release_time).TotalSeconds
Write-Host "Time difference: $time_difference"
if ($time_difference -le 86400) {
Write-Host "The latest release is less than 24 hours old. Additional building tests will be cunducted."
"should_ship_build_tests=false" | Out-File -FilePath $env:GITHUB_ENV -Append
} else {
Write-Host "The latest release is more than 24 hours old. Additional building tests will be skipped."
"should_ship_build_tests=true" | Out-File -FilePath $env:GITHUB_ENV -Append
}
}catch{
Write-Host "No release found. Additional building tests will be skipped."
"should_ship_build_tests=true" | Out-File -FilePath $env:GITHUB_ENV -Append
}
- name: Checkout repository
if: ${{ env.should_ship_build_tests == 'false' }}
uses: actions/checkout@v4
- if: ${{ env.should_ship_build_tests == 'false' }}
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip' # caching pip dependencies
- name: Build
if: ${{ env.should_ship_build_tests == 'false' }}
shell: pwsh
run: |
Install-Module -Name PSComputerManagementZp -Force
Import-Module PSComputerManagementZp
choco install fontforge --yes --limitoutput --force
Add-PathToCurrentProcessEnvPath -Path "C:\Program Files (x86)\FontForgeBuilds\bin"
pip install -r "./requirements.txt" -q
. ".\build.ps1"