screenshots.yml

  1name: Generate Screenshots
  2
  3on:
  4  workflow_dispatch:
  5  release:
  6    types: [published]
  7
  8permissions:
  9  contents: write
 10  pull-requests: write
 11
 12jobs:
 13  generate-screenshots:
 14    name: Generate Feature Screenshots
 15    runs-on: ubuntu-latest
 16    steps:
 17      - name: Checkout code
 18        uses: actions/checkout@v6
 19        with:
 20          ref: master
 21          persist-credentials: false
 22
 23      - name: Set up Go
 24        uses: actions/setup-go@v6
 25        with:
 26          go-version: "stable"
 27
 28      - name: Create Dummy Config
 29        run: |
 30          mkdir -p ~/.config/matcha
 31          cat <<EOF > ~/.config/matcha/config.json
 32          {
 33            "accounts": [
 34              {
 35                "id": "demo-user",
 36                "name": "Matcha Client",
 37                "email": "matcha@floatpane.com",
 38                "password": "dummy-password",
 39                "service_provider": "custom",
 40                "fetch_email": "matcha@floatpane.com"
 41              }
 42            ]
 43          }
 44          EOF
 45
 46      - name: Create Dummy Drafts
 47        run: |
 48          cat <<EOF > ~/.config/matcha/drafts.json
 49          {
 50            "drafts": [
 51              {
 52                "id": "draft-001",
 53                "to": "team@example.com",
 54                "subject": "Q1 Planning Document",
 55                "body": "# Q1 Planning\n\nHere are the key objectives for Q1...",
 56                "account_id": "demo-user"
 57              },
 58              {
 59                "id": "draft-002",
 60                "to": "alice@example.com",
 61                "subject": "Re: Design Review Feedback",
 62                "body": "Thanks for the review! I'll address the comments...",
 63                "account_id": "demo-user"
 64              }
 65            ],
 66            "updated_at": "2026-01-15T10:00:00Z"
 67          }
 68          EOF
 69
 70      - name: Build Matcha
 71        env:
 72          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 73        run: |
 74          LATEST_TAG=$(gh release view --json tagName -q ".tagName" 2>/dev/null || echo "dev")
 75          echo "Using version: $LATEST_TAG"
 76
 77          git fetch --tags 2>/dev/null || true
 78
 79          COMMIT=$(git rev-parse --short HEAD)
 80          DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
 81          go build -ldflags="-s -w -X main.version=$LATEST_TAG -X main.commit=$COMMIT -X main.date=$DATE" -o matcha .
 82          go build -o email_view ./screenshots/cmd/email_view
 83          go build -o inbox_view ./screenshots/cmd/inbox_view
 84
 85      - name: Prepare Tapes
 86        run: |
 87          for tape in screenshots/*.tape; do
 88            [ "$tape" = "screenshots/common.tape" ] && continue
 89            sed -i 's|go run \./screenshots/cmd/email_view|./email_view|' "$tape"
 90            sed -i 's|go run \./screenshots/cmd/inbox_view|./inbox_view|' "$tape"
 91            sed -i 's|go run \.|./matcha|' "$tape"
 92          done
 93
 94      - name: Install Dependencies
 95        run: |
 96          sudo apt-get update
 97          sudo apt-get install -y ffmpeg ttyd
 98          mkdir -p ~/.local/share/fonts
 99          wget -q https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/JetBrainsMono.zip
100          unzip -o JetBrainsMono.zip -d ~/.local/share/fonts
101          fc-cache -fv
102          go install github.com/charmbracelet/vhs@latest
103
104      - name: Generate Screenshots
105        env:
106          CLICOLOR_FORCE: "1"
107        run: |
108          mkdir -p docs/docs/assets/
109          for tape in screenshots/*.tape; do
110            [ "$tape" = "screenshots/common.tape" ] && continue
111            name=$(basename "$tape" .tape)
112            echo "==> Generating screenshot: $name"
113            TERM=xterm-256color vhs "$tape" || echo "Warning: $name failed"
114          done
115          # Move generated screenshots to public assets, clean up intermediate gifs
116          mv screenshots/*.png docs/docs/assets/ 2>/dev/null || true
117          rm -f screenshots/*.gif 2>/dev/null || true
118          ls -la public/assets/screenshots/
119
120      - name: Create Pull Request
121        uses: peter-evans/create-pull-request@v8
122        with:
123          token: ${{ secrets.GITHUB_TOKEN }}
124          commit-message: "docs: update feature screenshots [skip ci]"
125          title: "docs: update feature screenshots"
126          body: |
127            This PR updates the feature screenshots based on the latest release version.
128
129            Generated automatically by the Generate Screenshots workflow.
130
131            ### Screenshots included:
132            - `main_menu.png` - Main menu / choice screen
133            - `compose_email.png` - Email composition with Markdown
134            - `compose_empty.png` - Clean compose interface
135            - `email_view.png` - HTML email with inline images and attachments
136            - `inbox_view.png` - Inbox with emails from various senders and dates
137            - `settings.png` - Settings / account management
138            - `drafts.png` - Draft management view
139          branch: "update-screenshots"
140          base: "master"
141          add-paths: public/assets/screenshots/