-
-
Notifications
You must be signed in to change notification settings - Fork 72
160 lines (138 loc) · 5.2 KB
/
screenshots.yml
File metadata and controls
160 lines (138 loc) · 5.2 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Generate Screenshots
on:
workflow_dispatch:
release:
types: [published]
permissions:
contents: write
pull-requests: write
jobs:
generate-screenshots:
if: github.event_name == 'workflow_dispatch' || github.event.release.prerelease == false
name: Generate Feature Screenshots
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: master
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: "stable"
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libpcsclite-dev
- name: Create Dummy Config
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: Create Dummy Drafts
run: |
cat <<EOF > ~/.config/matcha/drafts.json
{
"drafts": [
{
"id": "draft-001",
"to": "team@example.com",
"subject": "Q1 Planning Document",
"body": "# Q1 Planning\n\nHere are the key objectives for Q1...",
"account_id": "demo-user"
},
{
"id": "draft-002",
"to": "alice@example.com",
"subject": "Re: Design Review Feedback",
"body": "Thanks for the review! I'll address the comments...",
"account_id": "demo-user"
}
],
"updated_at": "2026-01-15T10:00:00Z"
}
EOF
- name: Build Matcha
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LATEST_TAG=$(gh release view --json tagName -q ".tagName" 2>/dev/null || echo "dev")
echo "Using version: $LATEST_TAG"
git fetch --tags 2>/dev/null || true
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 .
go build -o email_view ./screenshots/cmd/email_view
go build -o inbox_view ./screenshots/cmd/inbox_view
- name: Prepare Tapes
run: |
for tape in screenshots/*.tape; do
[ "$tape" = "screenshots/common.tape" ] && continue
sed -i 's|go run \./screenshots/cmd/email_view|./email_view|' "$tape"
sed -i 's|go run \./screenshots/cmd/inbox_view|./inbox_view|' "$tape"
sed -i 's|go run \.|./matcha|' "$tape"
done
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg ttyd
mkdir -p ~/.local/share/fonts
wget -q 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
- name: Generate Screenshots
env:
CLICOLOR_FORCE: "1"
run: |
mkdir -p docs/docs/assets/features/
for tape in screenshots/*.tape; do
[ "$tape" = "screenshots/common.tape" ] && continue
name=$(basename "$tape" .tape)
echo "==> Generating screenshot: $name"
TERM=xterm-256color vhs "$tape" || echo "Warning: $name failed"
done
# Move generated screenshots to public assets, clean up intermediate gifs
mv screenshots/*.png docs/docs/assets/features/ 2>/dev/null || true
rm -f screenshots/*.gif 2>/dev/null || true
ls -la docs/docs/assets/features/
- name: Generate PR Body
id: pr-body
run: |
BODY="## What?
Refreshes the feature screenshots in \`docs/docs/assets/features/\`.
### Screenshots included:"
for png in docs/docs/assets/features/*.png; do
[ -f "$png" ] || continue
filename=$(basename "$png")
BODY="$BODY
- \`$filename\`"
done
BODY="$BODY
## Why?
Keeps documentation visuals aligned with the current TUI. Generated automatically by the Generate Screenshots workflow on the latest release."
echo "body<<EOF" >> $GITHUB_OUTPUT
echo "$BODY" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
commit-message: "docs: update feature screenshots"
title: "docs: update feature screenshots"
body: ${{ steps.pr-body.outputs.body }}
branch: "update-screenshots"
base: "master"
add-paths: docs/docs/assets/features/
labels: documentation