Auto Update and Release #346
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Update and Release | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
auto-update-and-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' # caching pip dependencies | |
- name: Check, compile and upload | |
shell: pwsh | |
run: | | |
sudo apt install fontforge | |
pip install -r "./requirements.txt" -q | |
$output = Invoke-Expression "python ./auto_update.py ${{secrets.PAT}}" | |
if ($output -match "Success"){ | |
git config --global user.email ${{ secrets.GIT_USER_EMAIL }} | |
git config --global user.name ${{ secrets.GIT_USER_NAME }} | |
git add . | |
git commit -m "Auto commit $((Get-Date).ToString("yyyy-MM-dd HH:mm:ss"))" | |
git push origin main | |
$jsonContent = Get-Content -Path './basicinfo.json' -Raw | |
$jsonData = $jsonContent | ConvertFrom-Json | |
git tag -a "$($jsonData.self.version)" -m "Auto tag $($jsonData.self.version)" | |
git push origin --delete "$($jsonData.self.version)" | |
git push origin "$($jsonData.self.version)" | |
"should_release_new=true" | Out-File -FilePath $env:GITHUB_ENV -Append | |
"release_name=$("Auto Release $($jsonData.self.version)")" | Out-File -FilePath $env:GITHUB_ENV -Append | |
"tag_name=$($jsonData.self.version)" | Out-File -FilePath $env:GITHUB_ENV -Append | |
"Auto release JetBrainsMonoNerdFonts: $($jsonData.self.version)" | Out-File -FilePath ./ReleaseNote.txt -Append | |
"- With [JetBrainsMono: $($jsonData.JetBrainsMono.version)]($($jsonData.JetBrainsMono.release_url_prefix)$($jsonData.JetBrainsMono.version))" | Out-File -FilePath ./ReleaseNote.txt -Append | |
"- With [nerd-fonts: $($jsonData.'nerd-fonts'.version)]($($jsonData.'nerd-fonts'.release_url_prefix)$($jsonData.'nerd-fonts'.version))" | Out-File -FilePath ./ReleaseNote.txt -Append | |
Move-Item "Output/JetBrainsMonoNerdFont-Regular.ttf" "Output/JetBrainsMonoNerdFont-Regular-$($jsonData.self.version).ttf" | |
}else{ | |
Write-Host "No update." | |
"should_release_new=false" | Out-File -FilePath $env:GITHUB_ENV -Append | |
} | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: ${{ (github.ref == 'refs/heads/main') && (env.should_release_new == 'true') }} | |
with: | |
name: ${{env.release_name}} | |
tag_name: ${{env.tag_name}} | |
body_path: ReleaseNote.txt | |
files: | | |
Output/JetBrainsMonoNerdFont-Regular* | |
token: ${{secrets.PAT}} | |