Skip to content

Commit 6d3a010

Browse files
committed
chore: basic tape and gif recording
1 parent f115dff commit 6d3a010

File tree

3 files changed

+144
-0
lines changed

3 files changed

+144
-0
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,23 @@ jobs:
109109
run: cargo build --verbose --locked
110110
- name: Run tests
111111
run: cargo test --verbose
112+
vhs:
113+
runs-on: macos-latest
114+
steps:
115+
- uses: actions/checkout@v3
116+
- uses: charmbracelet/vhs-action@v1
117+
with:
118+
path: "assets/envfetch.tape"
119+
- uses: stefanzweifel/git-auto-commit-action@v4
120+
env:
121+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
with:
123+
commit_message: Update generated VHS GIF
124+
branch: main
125+
commit_user_name: vhs-action 📼
126+
commit_user_email: [email protected]
127+
commit_author: vhs-action 📼 <[email protected]>
128+
file_pattern: "*.gif"
112129
coverage:
113130
runs-on: ubuntu-latest
114131

.github/workflows/vhs.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: comment gif
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
pr:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
11+
- uses: charmbracelet/vhs-action@v1
12+
with:
13+
path: "assets/envfetch.tape"
14+
15+
- name: Upload GIF to PR
16+
id: upload-pr-asset
17+
uses: actions/upload-release-asset@v1
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
with:
21+
upload_url: ${{ github.event.pull_request.comments_url }}
22+
asset_path: ./envfetch.gif
23+
asset_name: envfetch.gif
24+
asset_content_type: image/gif
25+
26+
- name: Comment on PR with direct link
27+
uses: marocchino/sticky-pull-request-comment@v2
28+
with:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
message: |
31+
## VHS Animation
32+
33+
![VHS Animation](https://github.com/${{ github.repository }}/blob/${{ github.sha }}/envfetch.gif?raw=true)

assets/envfetch.tape

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Source code for the VHS envfetch example.
2+
#
3+
# To run:
4+
#
5+
# vhs assets/envfetch.tape
6+
7+
# VHS documentation
8+
#
9+
# Output:
10+
# Output <path>.gif Create a GIF output at the given <path>
11+
# Output <path>.mp4 Create an MP4 output at the given <path>
12+
# Output <path>.webm Create a WebM output at the given <path>
13+
#
14+
# Require:
15+
# Require <string> Ensure a program is on the $PATH to proceed
16+
#
17+
# Settings:
18+
# Set FontSize <number> Set the font size of the terminal
19+
# Set FontFamily <string> Set the font family of the terminal
20+
# Set Height <number> Set the height of the terminal
21+
# Set Width <number> Set the width of the terminal
22+
# Set LetterSpacing <float> Set the font letter spacing (tracking)
23+
# Set LineHeight <float> Set the font line height
24+
# Set LoopOffset <float>% Set the starting frame offset for the GIF loop
25+
# Set Theme <json|string> Set the theme of the terminal
26+
# Set Padding <number> Set the padding of the terminal
27+
# Set Framerate <number> Set the framerate of the recording
28+
# Set PlaybackSpeed <float> Set the playback speed of the recording
29+
# Set MarginFill <file|#000000> Set the file or color the margin will be filled with.
30+
# Set Margin <number> Set the size of the margin. Has no effect if MarginFill isn't set.
31+
# Set BorderRadius <number> Set terminal border radius, in pixels.
32+
# Set WindowBar <string> Set window bar type. (one of: Rings, RingsRight, Colorful, ColorfulRight)
33+
# Set WindowBarSize <number> Set window bar size, in pixels. Default is 40.
34+
# Set TypingSpeed <time> Set the typing speed of the terminal. Default is 50ms.
35+
#
36+
# Sleep:
37+
# Sleep <time> Sleep for a set amount of <time> in seconds
38+
#
39+
# Type:
40+
# Type[@<time>] "<characters>" Type <characters> into the terminal with a
41+
# <time> delay between each character
42+
#
43+
# Keys:
44+
# Escape[@<time>] [number] Press the Escape key
45+
# Backspace[@<time>] [number] Press the Backspace key
46+
# Delete[@<time>] [number] Press the Delete key
47+
# Insert[@<time>] [number] Press the Insert key
48+
# Down[@<time>] [number] Press the Down key
49+
# Enter[@<time>] [number] Press the Enter key
50+
# Space[@<time>] [number] Press the Space key
51+
# Tab[@<time>] [number] Press the Tab key
52+
# Left[@<time>] [number] Press the Left Arrow key
53+
# Right[@<time>] [number] Press the Right Arrow key
54+
# Up[@<time>] [number] Press the Up Arrow key
55+
# Down[@<time>] [number] Press the Down Arrow key
56+
# PageUp[@<time>] [number] Press the Page Up key
57+
# PageDown[@<time>] [number] Press the Page Down key
58+
# Ctrl+<key> Press the Control key + <key> (e.g. Ctrl+C)
59+
#
60+
# Display:
61+
# Hide Hide the subsequent commands from the output
62+
# Show Show the subsequent commands in the output
63+
64+
Output envfetch.gif
65+
66+
Require envfetch
67+
68+
Set TypingSpeed 400ms
69+
Set FontSize 32
70+
Set Width 2400
71+
Set Height 1200
72+
73+
# Basic set
74+
Type "envfetch set MY_VAR_TEST 'Hello for everyone!' -- echo hello" Sleep 500ms Enter
75+
Sleep 500ms
76+
Type "envfetch get MY_VAR_TEST" Sleep 500ms Enter
77+
Sleep 500ms
78+
# Global set
79+
Type "envfetch set MY_VAR_TEST 'Hello for everyone!' --global" Sleep 500ms Enter
80+
Sleep 500ms
81+
# Get with wrong name
82+
Type "envfetch get MY_VAR_TESTT" Sleep 500ms Enter
83+
Sleep 500ms
84+
# Get with normal name
85+
Type "envfetch get MY_VAR_TEST" Sleep 500ms Enter
86+
Sleep 500ms
87+
# Add globally
88+
Type "envfetch add MY_VAR_TEST ! --global" Sleep 500ms Enter
89+
Sleep 500ms
90+
# Remove globally
91+
Type "envfetch delete MY_VAR_TEST --global" Sleep 500ms Enter
92+
Sleep 500ms
93+
94+
Sleep 5s

0 commit comments

Comments
 (0)