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 with:
20 persist-credentials: false
21
22 - name: Set up Go
23 uses: actions/setup-go@v6
24 with:
25 go-version: "stable"
26
27 - name: Create Dummy Config
28 # Create the config in the workspace so we can map HOME to it for the container.
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 }
41 ]
42 }
43 EOF
44 - name: Build Matcha
45 env:
46 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47 run: |
48 LATEST_TAG=$(gh release view --json tagName -q ".tagName")
49 echo "Found latest release: $LATEST_TAG"
50
51 git fetch --tags
52
53 COMMIT=$(git rev-parse --short HEAD)
54 DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
55 go build -ldflags="-s -w -X main.version=$LATEST_TAG -X main.commit=$COMMIT -X main.date=$DATE" -o matcha .
56
57 - name: Prepare Tape
58 # Patch the tape to run the compiled binary instead of "go run ."
59 # This works seamlessly because the typing of this command is 'Hidden' in your tape.
60 run: sed -i 's/go run ./.\/matcha/' demo.tape
61
62 - name: Run VHS'
63 env:
64 CLICOLOR_FORCE: "1"
65 run: |
66 sudo apt update
67 sudo apt install -y ffmpeg ttyd
68 mkdir -p ~/.local/share/fonts
69 wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/JetBrainsMono.zip
70 unzip -o JetBrainsMono.zip -d ~/.local/share/fonts
71 fc-cache -fv
72 go install github.com/charmbracelet/vhs@latest
73 TERM=xterm-256color vhs demo.tape
74
75 - name: Move GIF to Assets
76 run: sudo mv demo.gif public/assets/demo.gif
77
78 - name: Create Pull Request
79 uses: peter-evans/create-pull-request@v8
80 with:
81 token: ${{ secrets.GITHUB_TOKEN }}
82 commit-message: "docs: update demo.gif from release [skip ci]"
83 title: "docs: update demo.gif"
84 body: |
85 This PR updates the demo GIF based on the latest release version.
86 Generated automatically by the Update Demo VHS workflow.
87 branch: "update-demo-gif"
88 base: "master"
89 add-paths: public/assets/demo.gif