summaryrefslogtreecommitdiff
path: root/.github/workflows/generate-gif.yml
blob: ab694b6ec8b2365c3366c2cc3c0c8bcde7e47064 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
name: Generate GIF Demo
on:
  push:
    branches: [main]
jobs:
  generate-gif:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
      - name: Set up Go (if required by vhs)
        uses: actions/setup-go@v3
        with:
          go-version: '1.22'
      - name: Install vhs
        run: |
          go install github.com/charmbracelet/vhs@latest
      - name: Install Gif Generation dependencies
        run: |
          sudo apt update
          sudo apt install ffmpeg ttyd -y
      - name: Build the termpicker binary for vhs
        run: go build -o termpicker ./cmd/termpicker
      - name: Generate GIF with vhs
        run: |
          vhs ./assets/demo.tape
      - name: Commit and push GIF update
        run: |
          git config --global user.name 'github-actions'
          git config --global user.email 'github-actions@github.com'
          if git diff --quiet; then
            echo "No changes to commit."
          else
            git add ./assets/demo.gif
            git commit -m 'Update GIF preview'
            git push
          fi
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}