ci: add workflow to render all logos

This will render all logos to be seen in `all_logos.md` using typst
This commit is contained in:
Adrian Groh 2023-09-29 14:21:01 +02:00
parent d3a1d12c34
commit 7527c3b18f
Signed by: Gobidev
GPG Key ID: 3AA3153E98B0D771
7 changed files with 82 additions and 10 deletions

View File

@ -1,7 +1,14 @@
on: [push, pull_request] on: [push, pull_request]
permissions:
contents: write
name: CI name: CI
env:
PF_INFO: "ascii"
PF_PAD1: 0
PF_PAD2: 0
PF_PAD3: 0
jobs: jobs:
checks: checks:
name: ${{ matrix.name }} (${{ matrix.target }}) name: ${{ matrix.name }} (${{ matrix.target }})
@ -77,12 +84,49 @@ jobs:
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: build command: build
args: --target=${{ matrix.target }} args: --target=${{ matrix.target }} --target-dir=/tmp
use-cross: ${{ matrix.cross }} use-cross: ${{ matrix.cross }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: pfetch-${{ matrix.target }}
path: /tmp/${{ matrix.target }}/debug/pfetch
- name: Test - name: Test
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: test command: test
args: --target=${{ matrix.target }} args: --target=${{ matrix.target }}
if: ${{ !matrix.cross }} if: ${{ !matrix.cross }}
render:
needs: checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Jetbrains Mono
run: sudo apt update && sudo apt install -y fonts-jetbrains-mono
- name: Install typst
uses: yusancky/setup-typst@v2
with:
version: 'v0.8.0'
- name: Download Artifact
uses: actions/download-artifact@v2
with:
name: pfetch-x86_64-unknown-linux-gnu
path: /tmp/
- name: Run render script
run: sudo chmod +x /tmp/pfetch && cd ./tools/ && ./render_all.sh /tmp/pfetch
- name: Commit Files
uses: EndBug/add-and-commit@v9
with:
add:
assets all_logos.md
default_author: github_actions
message: "chore(logos): re-render all logos"

View File

@ -23,6 +23,8 @@ Leap, OpenWrt, Oracle Linux _(new)_, Parabola, Pop!\_OS _(updated)_, PureOS,
Raspbian, Rocky Linux _(new)_, SerenityOS, Slackware, Solus, SteamOS _(new)_, Raspbian, Rocky Linux _(new)_, SerenityOS, Slackware, Solus, SteamOS _(new)_,
Solaris, Ubuntu, Vanilla OS _(new)_, Void Linux, Windows _(new)_, Xeonix Linux Solaris, Ubuntu, Vanilla OS _(new)_, Void Linux, Windows _(new)_, Xeonix Linux
You can check out how they look [here](./all_logos.md).
For all other distributions, a penguin will be displayed. For all other distributions, a penguin will be displayed.
_Credit to [the original pfetch](https://github.com/dylanaraps/pfetch) and _Credit to [the original pfetch](https://github.com/dylanaraps/pfetch) and

View File

@ -49,6 +49,7 @@ commit_parsers = [
{ message = "^style", group = "Styling"}, { message = "^style", group = "Styling"},
{ message = "^test", group = "Testing"}, { message = "^test", group = "Testing"},
{ message = "^chore\\(release\\): prepare for", skip = true}, { message = "^chore\\(release\\): prepare for", skip = true},
{ message = "^chore\\(logos\\): re-render all logos", skip = true},
{ message = "^chore", group = "Miscellaneous"}, { message = "^chore", group = "Miscellaneous"},
{ body = ".*security", group = "Security"}, { body = ".*security", group = "Security"},
] ]

8
print_all.sh → tools/all_logos.txt Executable file → Normal file
View File

@ -1,10 +1,3 @@
#!/bin/bash
# A small script to run pfetch (command specified with arguments) with all available logos
while read -r logo; do
PF_ASCII=$logo "$@"
done << EOF
alma alma
alpine alpine
android android
@ -70,4 +63,3 @@ vanilla
void void
windows windows
xeonix xeonix
EOF

7
tools/print_all.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
# A small script to run pfetch (command specified with arguments) with all available logos
while read -r logo; do
PF_ASCII=$logo "$@"
done < ./all_logos.txt

14
tools/render_all.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
echo "# List Of All Logos" > ../all_logos.md
echo "Generated using \`./tools/render_all.sh\`" >> ../all_logos.md
while read -r logo; do
echo "$logo"
PF_ASCII=$logo "$@" > ./tmp || exit 1
mkdir -p ../assets/logos
typst compile -f svg renderer.typ ../assets/logos/"$logo".svg || exit 1
echo "## $logo" >> ../all_logos.md
echo "<img src=\"./assets/logos/$logo.svg\" width=\"230\">" >> ../all_logos.md
echo "" >> ../all_logos.md
done < ./all_logos.txt
rm tmp

12
tools/renderer.typ Normal file
View File

@ -0,0 +1,12 @@
#import "@preview/ansi-render:0.5.0": *
#set page(width: auto, height: auto, margin: .5cm)
#ansi-render(
read("./tmp"),
theme: terminal-themes.putty,
bold-is-bright: true,
font: "JetBrains Mono",
inset: 8pt,
radius: 5pt,
)