From 06d8b52b94bea163ea022ed7db856237560215c0 Mon Sep 17 00:00:00 2001 From: JEEVITHA KANNAN K S Date: Fri, 1 Nov 2024 01:30:25 +0530 Subject: [PATCH] ci: Seperate preview from Linutil Release (#792) * Seperate preview from linutil.yml * Fix paths as per https://github.com/ChrisTitusTech/linutil/pull/791 * Refact commit msg * Update preview.yml --- .github/workflows/linutil.yml | 25 ++++------------ .github/workflows/preview.yml | 55 +++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/preview.yml diff --git a/.github/workflows/linutil.yml b/.github/workflows/linutil.yml index 53c43d02..6b167aa6 100644 --- a/.github/workflows/linutil.yml +++ b/.github/workflows/linutil.yml @@ -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/vhs-action@v2.1.0 + - name: Upload build artifacts + uses: actions/upload-artifact@v4 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.version }} - file_pattern: "docs/assets/preview.gif" - add_options: "--force" - if: success() \ No newline at end of file + name: linutil-artifact + path: build/x86_64-unknown-linux-musl/release/linutil + compression-level: 0 + overwrite: true \ No newline at end of file diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 00000000..82bd17f1 --- /dev/null +++ b/.github/workflows/preview.yml @@ -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/vhs-action@v2.1.0 + 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()