diff --git a/.github/preview.gif b/.github/preview.gif index 9c56f66..b5e3bd5 100644 Binary files a/.github/preview.gif and b/.github/preview.gif differ diff --git a/.github/preview.tape b/.github/preview.tape index 69731f2..1579067 100644 --- a/.github/preview.tape +++ b/.github/preview.tape @@ -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 diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml deleted file mode 100644 index d900444..0000000 --- a/.github/workflows/preview.yml +++ /dev/null @@ -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() diff --git a/preview.sh b/preview.sh new file mode 100755 index 0000000..ce2ff44 --- /dev/null +++ b/preview.sh @@ -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"