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 name: Generate and Update Demo GIF
15 runs-on: ubuntu-latest
16 steps:
17 - name: Checkout code
18 uses: actions/checkout@v6
19
20 - name: Set up Go
21 uses: actions/setup-go@v6
22 with:
23 go-version: "stable"
24
25 - name: Build Matcha
26 # We build the binary so we can run it inside the VHS container
27 # (which likely doesn't have Go installed).
28 run: go build -o matcha .
29
30 - name: Create Dummy Config
31 # Create the config in the workspace so we can map HOME to it for the container.
32 run: |
33 mkdir -p .config/matcha
34 cat <<EOF > .config/matcha/config.json
35 {
36 "accounts": [
37 {
38 "id": "demo-user",
39 "name": "Matcha Client",
40 "email": "matcha@floatpane.com",
41 "password": "dummy-password",
42 "service_provider": "custom"
43 }
44 ]
45 }
46 EOF
47
48 - name: Prepare Tape
49 # Patch the tape to run the compiled binary instead of "go run ."
50 # This works seamlessly because the typing of this command is 'Hidden' in your tape.
51 run: sed -i 's/go run ./.\/matcha/' demo.tape
52
53 - name: Run VHS
54 uses: charmbracelet/vhs-action@v2
55 with:
56 path: "demo.tape"
57 install-fonts: true
58 env:
59 # Point HOME to /github/workspace so the app finds .config/matcha/config.json
60 HOME: /github/workspace
61
62 - name: Move GIF to Assets
63 run: sudo mv demo.gif public/assets/demo.gif
64
65 - name: Create Pull Request
66 uses: peter-evans/create-pull-request@v6
67 with:
68 token: ${{ secrets.GITHUB_TOKEN }}
69 commit-message: "docs: update demo.gif from release [skip ci]"
70 title: "docs: update demo.gif"
71 body: |
72 This PR updates the demo GIF based on the latest release version.
73 Generated automatically by the Update Demo VHS workflow.
74 branch: "update-demo-gif"
75 base: "main"
76 add-paths: public/assets/demo.gif