demo.yml

 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@v4
19
20      - name: Set up Go
21        uses: actions/setup-go@v5
22        with:
23          go-version: "stable"
24
25      - name: Install VHS
26        run: |
27          sudo mkdir -p /etc/apt/keyrings
28          curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg
29          echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list
30          sudo apt-get update
31          sudo apt-get install -y vhs
32
33      - name: Create Dummy Config
34        # Creates the config file expected by config/config.go
35        # using the "custom" provider to bypass specific Gmail/iCloud checks.
36        run: |
37          mkdir -p ~/.config/matcha
38          cat <<EOF > ~/.config/matcha/config.json
39          {
40            "accounts": [
41              {
42                "id": "demo-user",
43                "name": "Matcha Client",
44                "email": "matcha@floatpane.com",
45                "password": "dummy-password",
46                "service_provider": "custom"
47              }
48            ]
49          }
50          EOF
51
52      - name: Run VHS
53        # Runs the tape file which executes "go run ."
54        run: vhs demo.tape
55
56      - name: Move GIF to Assets
57        # The README expects the image at public/assets/demo.gif
58        # simpler to overwrite the existing one than change the tape output.
59        run: mv demo.gif public/assets/demo.gif
60
61      - name: Create Pull Request
62        uses: peter-evans/create-pull-request@v6
63        with:
64          token: ${{ secrets.GITHUB_TOKEN }}
65          commit-message: "chore: update demo.gif from release [skip ci]"
66          title: "chore: update demo.gif"
67          body: |
68            This PR updates the demo GIF based on the latest release version.
69            Generated automatically by the Update Demo VHS workflow.
70          branch: "update-demo-gif"
71          base: "main"
72          add-paths: public/assets/demo.gif