Skip to content

Prepare for release

Prepare for release #4

name: Build on Windows
on:
push:
branches:
- main
schedule:
- cron: '0 0 1 * *'
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip' # caching pip dependencies
- name: Build
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 gftools fonttools[woff]
$hash = Get-FileHash -Path ./Output/JetBrainsMonoNerdFont-Regular.ttf -Algorithm MD5
.\build.ps1
$newHash = Get-FileHash -Path ./Output/JetBrainsMonoNerdFont-Regular.ttf -Algorithm MD5
if ($hash.Hash -eq $newHash.Hash) {
Write-Host "MD5 hash of font file unchanged, no changes detected."
Write-Host "The MD5 is $hash"
}else{
Write-Host "MD5 hash of font file changed, pushing to repository..."
Write-Host "The old MD5 is $hash"
Write-Host "The new MD5 is $newHash"
}
- name: Install ossutil
shell: pwsh
run: |
Invoke-WebRequest -Uri 'https://gosspublic.alicdn.com/ossutil/1.7.16/ossutil-v1.7.16-windows-amd64.zip' -OutFile "$Env:TMP\ossutil-v1.7.16-windows-amd64.zip"
Expand-Archive -Path "$Env:TMP\ossutil-v1.7.16-windows-amd64.zip" -DestinationPath "$Env:TMP\ossutil-v1.7.16-windows-amd64"
Install-Module -Name PSComputerManagementZp -Force
Import-Module PSComputerManagementZp -Force
Add-PathToCurrentProcessEnvPath -Path "$Env:TMP\ossutil-v1.7.16-windows-amd64\ossutil-v1.7.16-windows-amd64"
- name: Upload otf to Aliyun OSS
env:
OSS_AccessKeyID: ${{ secrets.ACCESS_KEY_ID }}
OSS_AccessKeySecret: ${{ secrets.ACCESS_KEY_SECRET }}
OSS_EndPoint: oss-cn-nanjing.aliyuncs.com
OSS_Bucket: cn-blog-images
shell: pwsh
run: |
Add-PathToCurrentProcessEnvPath -Path "$Env:TMP\ossutil-v1.7.16-windows-amd64\ossutil-v1.7.16-windows-amd64"
ossutil64 config -e $Env:OSS_EndPoint -i $Env:OSS_AccessKeyID -k $Env:OSS_AccessKeySecret -L CH
ossutil64.exe cp ./Output/JetBrainsMonoNerdFont-Regular.ttf oss://$Env:OSS_Bucket/compile/JetBrainsMonoNerdFont-Regular.ttf