Skip to content

Commit

Permalink
ci: Seperate preview from Linutil Release (#792)
Browse files Browse the repository at this point in the history
* Seperate preview from linutil.yml

* Fix paths as per #791

* Refact commit msg

* Update preview.yml
  • Loading branch information
jeevithakannan2 authored Oct 31, 2024
1 parent 4ee2789 commit 06d8b52
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 19 deletions.
25 changes: 6 additions & 19 deletions .github/workflows/linutil.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,10 @@ jobs:
version: ${{ env.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Preview
run: |
echo "$(pwd)/build" >> $GITHUB_PATH
- name: Generate preview
uses: charmbracelet/[email protected]
with:
path: "docs/assets/preview.tape"

- name: Move preview
run: |
mv preview.gif docs/assets/preview.gif
- name: Upload preview
uses: stefanzweifel/git-auto-commit-action@v5
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
commit_message: Preview for ${{ env.version }}
file_pattern: "docs/assets/preview.gif"
add_options: "--force"
if: success()
name: linutil-artifact
path: build/x86_64-unknown-linux-musl/release/linutil
compression-level: 0
overwrite: true
55 changes: 55 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: LinUtil Preview

on:
workflow_dispatch:
inputs:
run_id:
description: 'Run ID of LinUtil Release'
required: true
workflow_run:
workflows: ["LinUtil Release"]
types:
- completed

jobs:
generate_preview:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set Run ID
run: |
if [ "${{ github.event_name }}" == "workflow_run" ]; then
echo "run_id=${{ github.event.workflow_run.id }}" >> $GITHUB_ENV
else
echo "run_id=${{ github.event.inputs.run_id }}" >> $GITHUB_ENV
fi
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: linutil-artifact
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ env.run_id }}

- name: Set env
run: |
chmod +x linutil
echo "${{ github.workspace }}" >> $GITHUB_PATH
- name: Generate preview
uses: charmbracelet/[email protected]
with:
path: "docs/assets/preview.tape"

- name: Move preview
run: mv preview.gif docs/assets/preview.gif

- name: Upload preview
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Preview for ${{ env.run_id }}
file_pattern: "docs/assets/preview.gif"
add_options: "--force"
if: success()

0 comments on commit 06d8b52

Please sign in to comment.