From 58427195d57fc6c0371295475b65daf0d5b5e9d2 Mon Sep 17 00:00:00 2001 From: "(Holloway) Chew, Kean Ho" Date: Tue, 5 Mar 2024 10:30:06 +0800 Subject: [PATCH] root: implemented CI for update.sh.ps1 To make sure the shell script is working as expected across all known OSes, we have to implement the CI elements for it. Hence, let's do this. This patch implements CI for update.sh.ps1 in root repository. Co-authored-by: Galyna, Cory Co-authored-by: (Holloway) Chew, Kean Ho Signed-off-by: (Holloway) Chew, Kean Ho --- .github/workflows/git-push.yml | 6 +++--- update.sh.ps1 | 22 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/git-push.yml b/.github/workflows/git-push.yml index ec08f0d..93b80df 100644 --- a/.github/workflows/git-push.yml +++ b/.github/workflows/git-push.yml @@ -33,10 +33,10 @@ jobs: run: | git config --global user.email "github.actions.runner@github.com" git config --global user.name "Github Action Automated Runner" - - name: Execute placeholder - id: native_ci_placeholder + - name: Execute Update Shell Script + id: native_ci_update_shell run: | - echo "hello world!\n" + ./update.sh.ps1 - name: Archive Payloads Artifacts if: always() uses: actions/upload-artifact@v3 diff --git a/update.sh.ps1 b/update.sh.ps1 index fc731cf..8b0cc4c 100755 --- a/update.sh.ps1 +++ b/update.sh.ps1 @@ -32,7 +32,27 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -Write-Host "Hi! Please double click the font for installation. TQ" +$Source = $PWD +$Destination = "C:\Windows\Fonts" + + +# Get the list from source files +$___list = Get-ChildItem -Path $Source -Include ('*.ttf', '*.woff', '*.otf', '*.ttc') -Recurse +foreach ($___file in $___list) { + $___dest = "${Destination}\$($___file.Name)" + if (-not (Test-Path -Path "${___dest}")) { + # copy the font file and install in. + Copy-Item -Path $___file.FullName -Destination "${___dest}" + + # register the font for all users + New-ItemProperty ` + -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Fonts" ` + -Name $___file.BaseName ` + -PropertyType String ` + -Value $___file.Name ` + -Force + } +} ################################################################################ # Windows POWERSHELL Codes # ################################################################################