Skip to content

Commit

Permalink
ci: update ci workflow for windows 2022
Browse files Browse the repository at this point in the history
- update the restart font cache job in the ci workflow for windows 2022
  • Loading branch information
falcucci committed Sep 21, 2024
1 parent a979a7b commit bd42679
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,33 +203,33 @@ jobs:
scoop bucket add nerd-fonts
scoop install Monaspace Monaspace-NF FiraCode-NF ProFont-NF CascadiaCode-NF Noto-NF
# - name: Restart font cache
# if: matrix.os == 'windows-2022'
# shell: powershell
# run: |
# Add-Type -TypeDefinition @"
# using System;
# using System.Runtime.InteropServices;
# public class FontHelper {
# [DllImport("gdi32.dll")]
# public static extern int AddFontResource(string lpFileName);
# }
# "@
# $fontPaths = @(
# "$env:USERPROFILE\scoop\apps\Monaspace-NF\current\*.ttf",
# "$env:USERPROFILE\scoop\apps\FiraCode-NF\current\*.ttf",
# "$env:USERPROFILE\scoop\apps\ProFont-NF\current\*.ttf",
# "$env:USERPROFILE\scoop\apps\CascadiaCode-NF\current\*.ttf",
# "$env:USERPROFILE\scoop\apps\Noto-NF\current\*.ttf"
# )
# foreach ($path in $fontPaths) {
# if (Test-Path -Path $path) {
# foreach ($font in Get-ChildItem -Path $path) {
# [FontHelper]::AddFontResource($font.FullName) | Out-Null
# }
# }
# }
# Write-Output "Fonts have been registered."
- name: Restart font cache
if: matrix.os == 'windows-2022'
shell: powershell
run: |
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class FontHelper {
[DllImport("gdi32.dll")]
public static extern int AddFontResource(string lpFileName);
}
"@
$fontPaths = @(
"$env:USERPROFILE\scoop\apps\Monaspace-NF\current\*.ttf",
"$env:USERPROFILE\scoop\apps\FiraCode-NF\current\*.ttf",
"$env:USERPROFILE\scoop\apps\ProFont-NF\current\*.ttf",
"$env:USERPROFILE\scoop\apps\CascadiaCode-NF\current\*.ttf",
"$env:USERPROFILE\scoop\apps\Noto-NF\current\*.ttf"
)
foreach ($path in $fontPaths) {
if (Test-Path -Path $path) {
foreach ($font in Get-ChildItem -Path $path) {
[FontHelper]::AddFontResource($font.FullName) | Out-Null
}
}
}
Write-Output "Fonts have been registered."
- name: Install Fonts
run: |
Expand Down

0 comments on commit bd42679

Please sign in to comment.