From 1d0fbc12d0d33703147cd87f4fea6c542b5fd120 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Mon, 9 Sep 2024 11:38:50 -0400 Subject: [PATCH] fix: fixed docs generation in release workflow --- .github/workflows/release.yaml | 10 +++------- scripts/generate-docs.sh | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 7 deletions(-) create mode 100755 scripts/generate-docs.sh diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 68c1232..0e47cb0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -86,13 +86,9 @@ jobs: uses: extractions/setup-just@v2 - name: "📗 Generate Documentation" - run: | - just gen-docs - git config user.name 'open-sauced[bot]' - git config user.email '63161813+open-sauced[bot]@users.noreply.github.com' - git add docs/ - git commit -m "chore: automated docs generation for release" || echo "No changes to commit" - git push origin HEAD:${{ github.ref }} + run: ./scripts/generate-docs.sh + env: + GITHUB_REF: ${{ github.ref }} - name: "🔧 Build all and upload artifacts to release" env: diff --git a/scripts/generate-docs.sh b/scripts/generate-docs.sh new file mode 100755 index 0000000..8b73d27 --- /dev/null +++ b/scripts/generate-docs.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Exit immediately if a command exits with a non-zero status. +set -e + +# Configure git to use the OpenSauced bot account +git config user.name 'open-sauced[bot]' +git config user.email '63161813+open-sauced[bot]@users.noreply.github.com' + +# Semantic release made changes, so pull the latest changes from the current branch +git pull origin "$GITHUB_REF" + +# Generate documentation +just gen-docs + +# Get the author of the last non-merge commit +LAST_COMMIT_AUTHOR=$(git log -1 --no-merges --pretty=format:'%an <%ae>') + +# Commit with co-authorship and push changes +git add docs/ +git commit -m "chore: automated docs generation for release + +Co-authored-by: $LAST_COMMIT_AUTHOR" || echo "No changes to commit" +git push origin HEAD:"$GITHUB_REF"