done with all this preview madness

This commit is contained in:
Chris Titus
2026-01-22 15:11:15 -06:00
parent e26c0525bc
commit 59753c1d20
4 changed files with 37 additions and 83 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 1.5 MiB

+4
View File
@@ -60,6 +60,10 @@ Output preview.gif
Require linutil
Require sh
Set Shell bash
Set FontFamily "JetBrainsMono NFM"
Set Width 2560
Set Height 1440
Set Theme nord
Sleep 1s
-83
View File
@@ -1,83 +0,0 @@
name: LinUtil Preview
on:
workflow_dispatch:
workflow_run:
workflows: ["LinUtil Release"]
types:
- completed
jobs:
generate_preview:
runs-on: ubuntu-latest
environment: linutil_env
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Get latest tag
id: latest_tag
uses: actions/github-script@v7
with:
script: |
const releases = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 1
});
return releases.data[0].tag_name;
- name: Set tag name
run: echo "tag_name=${{ steps.latest_tag.outputs.result }}" >> $GITHUB_ENV
- name: Download binary
run: |
curl -LO "https://github.com/${{ github.repository }}/releases/download/${{ env.tag_name }}/linutil"
- name: Set env
run: |
chmod +x linutil
mkdir -p build
mv linutil build/linutil
echo "${{ github.workspace }}/build" >> $GITHUB_PATH
echo "branch_name=${{ env.tag_name }}" | tr . - >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg ttyd fonts-jetbrains-mono
- name: Install VHS
run: |
go install github.com/charmbracelet/vhs@latest
echo "$HOME/go/bin" >> $GITHUB_PATH
- name: Refresh font cache
run: fc-cache -f -v
- name: Generate preview with VHS
env:
TERM: xterm-256color
run: |
export PATH="$HOME/go/bin:$PATH"
vhs .github/preview.tape
- name: Move preview
run: mv preview.gif .github/preview.gif
- name: Create PR
uses: peter-evans/create-pull-request@v7
with:
commit-message: Preview for ${{ env.tag_name }}
branch: preview-${{ env.branch_name }}
title: "Update preview for ${{ env.tag_name }}"
labels: |
documentation
body: |
Automated PR to update preview gif for version ${{ env.tag_name }}
![preview](https://raw.githubusercontent.com/${{ github.repository }}/preview-${{ env.branch_name }}/.github/preview.gif)
if: success()
Executable
+33
View File
@@ -0,0 +1,33 @@
#!/bin/bash
# Script to generate preview.gif locally using VHS
# Requirements: vhs, ffmpeg, ttyd, and JetBrains Mono font
set -e
# Check if VHS is installed
if ! command -v vhs &> /dev/null; then
echo "Error: VHS is not installed"
echo "Install it with: go install github.com/charmbracelet/vhs@latest"
exit 1
fi
# Check if linutil binary exists
if ! command -v linutil &> /dev/null && [ ! -f "./build/linutil" ] && [ ! -f "./target/release/linutil" ]; then
echo "Error: linutil binary not found"
echo "Build it first with: cargo build --release"
exit 1
fi
# Add linutil to PATH if needed
if [ -f "./target/release/linutil" ]; then
export PATH="$PWD/target/release:$PATH"
elif [ -f "./build/linutil" ]; then
export PATH="$PWD/build:$PATH"
fi
echo "Generating preview.gif..."
cd .github
vhs preview.tape
echo "✓ Preview generated successfully at .github/preview.gif"