1name: Update Demo VHS
2
3on:
4 workflow_dispatch:
5 release:
6 types: [published]
7
8permissions:
9 contents: write
10 pull-requests: write
11
12jobs:
13 update-demo:
14 if: github.event_name == 'workflow_dispatch' || github.event.release.prerelease == false
15 name: Generate and Update Demo GIF
16 runs-on: ubuntu-latest
17 steps:
18 - name: Checkout code
19 uses: actions/checkout@v7
20 with:
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: Install system dependencies
29 run: sudo apt-get update && sudo apt-get install -y libpcsclite-dev
30
31 - name: Create Dummy Config
32 # Create the config in the workspace so we can map HOME to it for the container.
33 run: |
34 mkdir -p ~/.config/matcha
35 cat <<EOF > ~/.config/matcha/config.json
36 {
37 "accounts": [
38 {
39 "id": "demo-user",
40 "name": "Matcha Client",
41 "email": "matcha@floatpane.com",
42 "password": "dummy-password",
43 "service_provider": "custom",
44 "fetch_email": "matcha@floatpane.com"
45 }
46 ]
47 }
48 EOF
49 - name: Build Matcha
50 env:
51 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52 run: |
53 LATEST_TAG=$(gh release view --json tagName -q ".tagName")
54 echo "Found latest release: $LATEST_TAG"
55
56 git fetch --tags
57
58 COMMIT=$(git rev-parse --short HEAD)
59 DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
60 go build -ldflags="-s -w -X main.version=$LATEST_TAG -X main.commit=$COMMIT -X main.date=$DATE" -o matcha .
61
62 - name: Prepare Tape
63 # Patch the tape to run the compiled binary instead of "go run ."
64 # This works seamlessly because the typing of this command is 'Hidden' in your tape.
65 run: sed -i 's/go run ./.\/matcha/' demo.tape
66
67 - name: Run VHS'
68 env:
69 CLICOLOR_FORCE: "1"
70 run: |
71 sudo apt update
72 sudo apt install -y ffmpeg ttyd
73 mkdir -p ~/.local/share/fonts
74 wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/JetBrainsMono.zip
75 unzip -o JetBrainsMono.zip -d ~/.local/share/fonts
76 fc-cache -fv
77 go install github.com/charmbracelet/vhs@latest
78 TERM=xterm-256color vhs demo.tape
79
80 - name: Move GIF to Assets
81 run: sudo mv demo.gif public/assets/demo.gif
82
83 - name: Create Pull Request
84 uses: peter-evans/create-pull-request@v8
85 with:
86 token: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
87 commit-message: "docs: update demo.gif from release"
88 title: "docs: update demo.gif"
89 body: |
90 ## What?
91
92 Replaces `public/assets/demo.gif` with a freshly recorded VHS run.
93
94 ## Why?
95
96 Keeps the demo GIF aligned with the latest release so README and docs reflect current behaviour. Generated automatically by the Update Demo VHS workflow.
97 branch: "update-demo-gif"
98 base: "master"
99 add-paths: public/assets/demo.gif
100 labels: documentation