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