-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Record tapes using VHS - initial version
- Loading branch information
1 parent
95e8bf2
commit 36359ac
Showing
14 changed files
with
231 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Record Demo Workflows And Publish Them To GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: [$default-branch] | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
- uses: actions/setup-go@v4 | ||
- name: Install VHS | ||
run: go version && go install github.com/charmbracelet/vhs@latest | ||
- name: Build keepac | ||
run: go build -o changelog | ||
- name: Record tapes | ||
run: ./scripts/record-tapes | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: "tapes/recordings" | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
# Changelog | ||
|
||
## [Unreleased] | ||
|
||
### Added | ||
|
||
- Something even more useful | ||
|
||
- The initial version | ||
- Something Why does this not get inserted at the end? | ||
- Something This is unexpected | ||
- Something really good | ||
- foo bar foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from os import path | ||
import os | ||
import pathlib | ||
import sys | ||
import subprocess | ||
|
||
project_root_folder = pathlib.Path(path.dirname(__file__), '..').resolve() | ||
tapes_folder = project_root_folder / 'tapes' | ||
dark_tapes_folder = tapes_folder / 'dark' | ||
light_tapes_folder = tapes_folder / 'light' | ||
gifs_folder = tapes_folder / 'recordings' | ||
|
||
|
||
def main() -> int: | ||
create_light_tapes() | ||
record_tapes() | ||
|
||
return 0 | ||
|
||
|
||
def create_light_tapes() -> None: | ||
for dark_tape in dark_tapes_folder.glob('*.tape'): | ||
with open(light_tapes_folder.joinpath(dark_tape.name), 'w') as light_tape: | ||
print(f"Creating light version of {light_tape.name}...") | ||
light_tape.write("# This file is auto-generated and will be overridden!\n\n") | ||
light_tape.write("Set Theme Github\n") | ||
light_tape.write(dark_tape.read_text()) | ||
|
||
|
||
def record_tapes() -> None: | ||
recorded_tapes = 0 | ||
|
||
|
||
|
||
for tapes in [light_tapes_folder, dark_tapes_folder]: | ||
colorscheme = tapes.name | ||
|
||
local_env = os.environ | ||
# Uses locally built version of keepac | ||
local_env["PATH"] = str(project_root_folder) + ":" + local_env["PATH"] | ||
# Auto-colorscheme detection does not work within vhs, so we manually | ||
# set the style here | ||
local_env["GLAMOUR_STYLE"] = colorscheme | ||
|
||
print(f"Recording {colorscheme} tapes...\n") | ||
for tape in tapes.glob('*.tape'): | ||
subprocess.run(['vhs', tape], env=local_env, cwd=tapes) | ||
|
||
recording = tapes / 'out.gif' | ||
tape_name = path.splitext(tape.name)[0] | ||
destination = gifs_folder / f'{tape_name}.{colorscheme}.gif' | ||
|
||
print(f"Moving {recording} to {destination}...") | ||
recording.rename(destination) | ||
recorded_tapes += 1 | ||
|
||
print("") | ||
|
||
print("Done!") | ||
print(f"Recorded {recorded_tapes} tapes.") | ||
|
||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.gif | ||
*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Require changelog | ||
|
||
Hide | ||
# Create new file | ||
Type "changelog init" | ||
Sleep 500ms | ||
Enter | ||
Sleep 1500ms | ||
Show | ||
|
||
# Trigger section selection | ||
Type "changelog insert" | ||
Sleep 500ms | ||
Enter | ||
Sleep 1500ms | ||
|
||
# Select "Fixed" | ||
Down | ||
Sleep 500ms | ||
Down | ||
Sleep 500ms | ||
Down | ||
Sleep 500ms | ||
Down | ||
Sleep 1500ms | ||
Enter | ||
|
||
Type "That one annoying bug" | ||
Enter | ||
|
||
Sleep 1500ms | ||
|
||
# Cleanup | ||
Hide | ||
Type rm CHANGELOG.md | ||
Enter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |