Generate Demo GIF #7
This file contains hidden or 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
| name: Generate Demo GIF | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'bashful.ts' | |
| - 'tools/demo-commands.sh' | |
| - '.github/workflows/demo.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| generate-demo: | |
| name: Record demo and convert to GIF | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Install asciinema and jq | |
| run: sudo apt-get install -y asciinema jq | |
| - name: Install agg | |
| run: | | |
| curl -fsSL "https://github.com/asciinema/agg/releases/latest/download/agg-x86_64-unknown-linux-gnu" \ | |
| -o /usr/local/bin/agg | |
| chmod +x /usr/local/bin/agg | |
| - name: Create docs directory | |
| run: mkdir -p docs | |
| - name: Record demo session | |
| env: | |
| # asciinema needs a home dir for config | |
| HOME: /root | |
| run: | | |
| chmod +x tools/demo-commands.sh | |
| asciinema rec docs/bashful-demo.cast \ | |
| --command "bash tools/demo-commands.sh" \ | |
| --cols 82 --rows 26 \ | |
| --overwrite | |
| - name: Convert cast to GIF | |
| run: | | |
| agg docs/bashful-demo.cast docs/demo.gif \ | |
| --font-size 14 \ | |
| --speed 1.2 \ | |
| --idle-time-limit 3 | |
| - name: Commit GIF directly to main | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add docs/demo.gif docs/bashful-demo.cast | |
| if git diff --staged --quiet; then | |
| echo "GIF unchanged — nothing to commit." | |
| exit 0 | |
| fi | |
| git commit -m "chore: regenerate demo GIF" | |
| git pull --rebase --autostash origin main | |
| git push origin HEAD:main |