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