84 lines
2.3 KiB
YAML
84 lines
2.3 KiB
YAML
name: LinUtil Preview
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
workflow_run:
|
|
workflows: ["LinUtil Release"]
|
|
types:
|
|
- completed
|
|
|
|
jobs:
|
|
generate_preview:
|
|
runs-on: ubuntu-latest
|
|
environment: linutil_env
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: Checkout source
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Get latest tag
|
|
id: latest_tag
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const releases = await github.rest.repos.listReleases({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
per_page: 1
|
|
});
|
|
return releases.data[0].tag_name;
|
|
|
|
- name: Set tag name
|
|
run: echo "tag_name=${{ steps.latest_tag.outputs.result }}" >> $GITHUB_ENV
|
|
|
|
- name: Download binary
|
|
run: |
|
|
curl -LO "https://github.com/${{ github.repository }}/releases/download/${{ env.tag_name }}/linutil"
|
|
|
|
- name: Set env
|
|
run: |
|
|
chmod +x linutil
|
|
mkdir -p build
|
|
mv linutil build/linutil
|
|
echo "${{ github.workspace }}/build" >> $GITHUB_PATH
|
|
echo "branch_name=${{ env.tag_name }}" | tr . - >> $GITHUB_ENV
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y ffmpeg ttyd fonts-jetbrains-mono
|
|
|
|
- name: Install VHS
|
|
run: |
|
|
go install github.com/charmbracelet/vhs@latest
|
|
echo "$HOME/go/bin" >> $GITHUB_PATH
|
|
|
|
- name: Refresh font cache
|
|
run: fc-cache -f -v
|
|
|
|
- name: Generate preview with VHS
|
|
env:
|
|
TERM: xterm-256color
|
|
run: |
|
|
export PATH="$HOME/go/bin:$PATH"
|
|
vhs .github/preview.tape
|
|
|
|
- name: Move preview
|
|
run: mv preview.gif .github/preview.gif
|
|
|
|
- name: Create PR
|
|
uses: peter-evans/create-pull-request@v7
|
|
with:
|
|
commit-message: Preview for ${{ env.tag_name }}
|
|
branch: preview-${{ env.branch_name }}
|
|
title: "Update preview for ${{ env.tag_name }}"
|
|
labels: |
|
|
documentation
|
|
body: |
|
|
Automated PR to update preview gif for version ${{ env.tag_name }}
|
|

|
|
if: success()
|