Skip to content

Commit bf3a86c

Browse files
committed
generate gif with vhs
1 parent 9903fd3 commit bf3a86c

File tree

5 files changed

+94
-8
lines changed

5 files changed

+94
-8
lines changed

.github/workflows/vhs.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
on:
2+
pull_request:
3+
paths:
4+
- .github/workflows/vhs.yml
5+
release:
6+
types: [published, edited]
7+
8+
permissions:
9+
contents: write
10+
11+
# NOTE
12+
# we don’t run `vhs` via tea because that would require us to install tea
13+
# first, and this `.tape` file is for recording the installation of tea
14+
15+
jobs:
16+
record:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
- run: sudo apt-get install finger
21+
- name: preinstall gum
22+
# looks better if we don’t need to initially “steep some leaves”
23+
run: |
24+
sudo mkdir -p /etc/apt/keyrings
25+
curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg
26+
echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list
27+
sudo apt-get update && sudo apt-get install gum
28+
- uses: charmbracelet/vhs-action@v1
29+
with:
30+
path: sample.tape
31+
- name: massage
32+
run: |
33+
mkdir out
34+
mv out.gif out/sample.gif
35+
- uses: JamesIves/github-pages-deploy-action@v4
36+
with:
37+
folder: out
38+
single-commit: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/out.gif

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[`install.sh`](./install.sh) is delivered when you `curl tea.xyz`.
44

5-
# GitHub Action 0.6.15
5+
# GitHub Action 0.7.0
66

77
This repository also provides the `tea` GitHub Action.
88

install.sh

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,21 @@ check_path() {
315315
}
316316

317317
check_shell_magic() {
318-
sh="$(basename "$SHELL")"
319-
if test "$sh" = zsh; then
318+
# foo knows I cannot tell you why $SHELL may be unset
319+
if test -z "$SHELL"; then
320+
if which finger >/dev/null 2>&1; then
321+
SHELL="$(finger "$USER" | grep Shell | cut -d: -f3 | tr -d ' ')"
322+
elif which getent >/dev/null 2>&1; then
323+
SHELL="$(basename "$(getent passwd "$USER")")"
324+
fi
325+
if test -z "$SHELL"; then
326+
# well dang
327+
SHELL="unknown"
328+
fi
329+
fi
330+
331+
case "$(basename "$SHELL")" in
332+
zsh)
320333
gum_func format -- <<-EOMD
321334
# want magic?
322335
tea’s shell magic works via a one-line addition to your \`~/.zshrc\` \\
@@ -332,7 +345,8 @@ check_shell_magic() {
332345
add-zsh-hook -Uz chpwd(){ source <(tea -Eds) } #tea
333346
EOSH
334347
fi
335-
elif test "$sh" = "fish"; then
348+
;;
349+
fish)
336350
gum_func format -- <<-EOMD
337351
# want magic?
338352
tea’s shell magic works via a simple hook function in fish \\
@@ -348,7 +362,8 @@ check_shell_magic() {
348362
function add_tea_environment --on-variable PWD; tea -Eds | source; end #tea
349363
EOSH
350364
fi
351-
elif test "$sh" = "bash"; then
365+
;;
366+
bash)
352367
gum_func format -- <<-EOMD
353368
# want magic?
354369
tea’s shell magic works via a simple function in bash \\
@@ -364,15 +379,16 @@ check_shell_magic() {
364379
cd() { builtin cd "\$@" || return; [ "\$OLDPWD" = "\$PWD" ] || source <(tea -Eds); }
365380
EOSH
366381
fi
367-
else
382+
;;
383+
*)
368384
gum_func format -- <<-EOMD
369385
# we need your help 🙏
370386
371-
our shell magic doesn’t support \`$sh\` yet, can you make a pull request?
387+
our shell magic doesn’t support \`$SHELL\` yet, can you make a pull request?
372388
373389
> https://github.com/teaxyz/cli/pulls
374390
EOMD
375-
fi
391+
esac
376392

377393
echo #spacer
378394
}

sample.tape

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Set FontSize 18
2+
Set Height 800
3+
Set Width 1200
4+
Set TypingSpeed 40ms
5+
6+
Require gum
7+
Require curl
8+
9+
Type "sh <(curl tea.xyz)"
10+
Sleep 0.5s
11+
12+
Backspace 8
13+
Type "-Ssf https://tea.xyz)"
14+
15+
Sleep 1s
16+
17+
Enter
18+
19+
Sleep 1s
20+
21+
Enter
22+
23+
Sleep 10s
24+
25+
Enter
26+
27+
Sleep 2s
28+
29+
Enter
30+
31+
Sleep 5s

0 commit comments

Comments
 (0)