2024-10-31 20:00:25 +00:00
|
|
|
name: LinUtil Preview
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
2024-11-01 18:43:05 +00:00
|
|
|
tag_name:
|
|
|
|
description: 'Tag name'
|
2024-10-31 20:00:25 +00:00
|
|
|
required: true
|
|
|
|
workflow_run:
|
|
|
|
workflows: ["LinUtil Release"]
|
|
|
|
types:
|
|
|
|
- completed
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
generate_preview:
|
|
|
|
runs-on: ubuntu-latest
|
2024-11-01 20:04:07 +00:00
|
|
|
environment: linutil_env
|
2024-11-01 18:43:05 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2024-11-01 19:27:58 +00:00
|
|
|
pull-requests: write
|
2024-10-31 20:00:25 +00:00
|
|
|
|
|
|
|
steps:
|
2024-11-01 18:43:05 +00:00
|
|
|
- name: Checkout source
|
|
|
|
uses: actions/checkout@v4
|
2024-10-31 20:00:25 +00:00
|
|
|
|
2024-11-01 18:43:05 +00:00
|
|
|
- name: Get tag name ( Workflow Run )
|
|
|
|
id: latest_tag
|
|
|
|
uses: actions/github-script@v7
|
2024-11-01 20:15:35 +00:00
|
|
|
if: github.event_name == 'workflow_run'
|
2024-10-31 20:00:25 +00:00
|
|
|
with:
|
2024-11-01 18:43:05 +00:00
|
|
|
script: |
|
|
|
|
const releases = await github.rest.repos.listReleases({
|
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
|
|
|
per_page: 1
|
|
|
|
});
|
2024-11-01 20:15:35 +00:00
|
|
|
core.setOutput('result', releases.data[0].tag_name);
|
2024-11-01 18:43:05 +00:00
|
|
|
result-encoding: string
|
|
|
|
|
|
|
|
- name: Set tag name ( Workflow Run )
|
2024-11-01 20:15:35 +00:00
|
|
|
if: github.event_name == 'workflow_run'
|
2024-11-01 18:43:05 +00:00
|
|
|
run: echo "tag_name=${{ steps.latest_tag.outputs.result }}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Set tag name ( Workflow Dispatch )
|
|
|
|
if: ${{ github.event_name }} == 'workflow_dispatch'
|
|
|
|
run: echo "tag_name=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Download binary
|
|
|
|
run: |
|
|
|
|
curl -LO "https://github.com/${{ github.repository }}/releases/download/${{ env.tag_name }}/linutil"
|
2024-10-31 20:00:25 +00:00
|
|
|
|
|
|
|
- name: Set env
|
|
|
|
run: |
|
|
|
|
chmod +x linutil
|
2024-11-01 18:43:05 +00:00
|
|
|
mkdir -p build
|
|
|
|
mv linutil build/linutil
|
|
|
|
echo "${{ github.workspace }}/build" >> $GITHUB_PATH
|
2024-10-31 20:00:25 +00:00
|
|
|
|
|
|
|
- name: Generate preview
|
|
|
|
uses: charmbracelet/vhs-action@v2.1.0
|
|
|
|
with:
|
|
|
|
path: "docs/assets/preview.tape"
|
|
|
|
|
|
|
|
- name: Move preview
|
|
|
|
run: mv preview.gif docs/assets/preview.gif
|
|
|
|
|
2024-11-01 18:43:05 +00:00
|
|
|
- name: Create PR
|
|
|
|
uses: peter-evans/create-pull-request@v7.0.5
|
2024-10-31 20:00:25 +00:00
|
|
|
with:
|
2024-11-01 20:04:07 +00:00
|
|
|
commit-message: Preview for ${{ env.tag_name }}
|
|
|
|
file-pattern: "docs/assets/preview.gif"
|
|
|
|
add-options: "--force"
|
|
|
|
token: ${{ secrets.PAT_TOKEN }}
|
|
|
|
branch: feature/preview-${{ env.tag_name }}
|
|
|
|
title: "Update preview for ${{ env.tag_name }}"
|
|
|
|
body: |
|
|
|
|
Automated PR to update preview gif for version ${{ env.tag_name }}
|
2024-11-01 18:45:39 +00:00
|
|
|
if: success()
|