Skip to content

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
  • Loading branch information
x0rzavi committed Apr 8, 2024
1 parent 0e75cc9 commit 77fa0fb
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 77 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/fonts.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: fonts
on:
on:
workflow_dispatch:
defaults:
run:
Expand All @@ -9,18 +9,18 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: source fonts.sh
- name: Tags
run: echo "fileTag=$(date +%d-%m-%Y-%H-%M)" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
with:
files: AppleFontsNerdPatched.7z
name: Apple Fonts Nerd Patched
tag_name: ${{ env.fileTag }}
- name: Checkout
uses: actions/checkout@v4

- name: Build
run: source fonts.sh

- name: Tags
run: echo "fileTag=$(date +%d-%m-%Y-%H-%M)" >> $GITHUB_ENV

- name: Release
uses: softprops/action-gh-release@v1
with:
files: AppleFonts.7z
name: Apple Fonts Nerd Patched
tag_name: ${{ env.fileTag }}
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#### Apple's SF Mono fonts automatically patched with Nerd Fonts Patcher :D
## Apple's SF Mono fonts automatically patched with Nerd Fonts Patcher :D

## Fonts included in archive

#### Inlcuded in archive -
- SF Pro
- SF Arabic
- SF Compact
- New York
- SF Mono (Nerd patched)
- New York
- SF Arabic
- SF Armenian
- SF Georgian
- SF Hebrew

## Courtesy

[Fonts - Apple Developer](https://developer.apple.com/fonts/)
90 changes: 33 additions & 57 deletions fonts.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,48 @@
# Dependencies: 7z, aria2

# Dependencies
sudo apt update
sudo apt update
sudo apt install p7zip-full aria2 -y

# Variables
directory=$(pwd)

apple_fonts () {
mkdir -p $directory/tmpdir
mkdir -p $directory/tmpdir/AppleFontsNerdPatched
mkdir -p $directory/tmpdir/AppleFonts
apple_fonts() {
mkdir -p $directory/tmpdir $directory/tmpdir/SF-Mono $directory/tmpdir/AppleFonts $directory/tmpdir/src
cd $directory/tmpdir

sf_pro () {
aria2c -x16 "https://devimages-cdn.apple.com/design/resources/download/SF-Pro.dmg"
7z x 'SF-Pro.dmg'
cd SFProFonts
7z x 'SF Pro Fonts.pkg'
7z x 'Payload~'
mv Library/Fonts/* $directory/tmpdir/AppleFontsNerdPatched
cd ..
}
sf_arabic () {
aria2c -x16 "https://devimages-cdn.apple.com/design/resources/download/SF-Arabic.dmg"
7z x 'SF-Arabic.dmg'
cd SFArabicFonts
7z x 'SF Arabic Fonts.pkg'
7z x 'Payload~'
mv Library/Fonts/* $directory/tmpdir/AppleFontsNerdPatched
cd ..
}
sf_compact () {
aria2c -x16 "https://devimages-cdn.apple.com/design/resources/download/SF-Compact.dmg"
7z x 'SF-Compact.dmg'
cd SFCompactFonts
7z x 'SF Compact Fonts.pkg'
7z x 'Payload~'
mv Library/Fonts/* $directory/tmpdir/AppleFontsNerdPatched
cd ..
}
ny () {
aria2c -x16 "https://devimages-cdn.apple.com/design/resources/download/NY.dmg"
7z x 'NY.dmg'
cd NYFonts
7z x 'NY Fonts.pkg'
7z x 'Payload~'
mv Library/Fonts/* $directory/tmpdir/AppleFontsNerdPatched
cd ..
}
sf_mono () {
aria2c -x16 "https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg"
7z x 'SF-Mono.dmg'
cd SFMonoFonts
7z x 'SF Mono Fonts.pkg'
download_links=(
"https://devimages-cdn.apple.com/design/resources/download/SF-Pro.dmg"
"https://devimages-cdn.apple.com/design/resources/download/SF-Arabic.dmg"
"https://devimages-cdn.apple.com/design/resources/download/SF-Compact.dmg"
"https://devimages-cdn.apple.com/design/resources/download/NY.dmg"
"https://devimages-cdn.apple.com/design/resources/download/SF-Armenian.dmg"
"https://devimages-cdn.apple.com/design/resources/download/SF-Georgian.dmg"
"https://devimages-cdn.apple.com/design/resources/download/SF-Hebrew.dmg"
"https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg"
)

for link in ${download_links[@]}; do
aria2c -x16 -s16 --continue=true "$link"
done

for archive in *.dmg; do
7z e "$archive" -y -osrc/
cd src/
7z x *.pkg -y
7z x 'Payload~'
mv Library/Fonts/* $directory/tmpdir/AppleFonts
cd ..
}
if [[ $archive == *"Mono"* ]]; then
mv Library/Fonts/* "$directory/tmpdir/SF-Mono/"
else
mv Library/Fonts/* "$directory/tmpdir/AppleFonts/"
fi
cd "$directory/tmpdir/"
rm -rf src/{*,.*}
done
rmdir src/

sf_pro # no nerd patches
sf_arabic # no nerd patches
sf_compact # no nerd patches
ny # no nerd patches
sf_mono # nerd patched

set +e && docker run --rm -v $directory/tmpdir/AppleFonts:/in -v $directory/tmpdir/AppleFontsNerdPatched:/out nerdfonts/patcher --no-progressbars --quiet && set -e
7z a $directory/AppleFontsNerdPatched.7z $directory/tmpdir/AppleFontsNerdPatched
set +e && docker run --rm -v $directory/tmpdir/SF-Mono/:/in:Z -v $directory/tmpdir/AppleFonts/:/out:Z nerdfonts/patcher --no-progressbars --quiet && set -e
7z a $directory/AppleFonts.7z $directory/tmpdir/AppleFonts
}

apple_fonts

0 comments on commit 77fa0fb

Please sign in to comment.