From d7fe4efd6a193890b284b61ee61033b26a952bd4 Mon Sep 17 00:00:00 2001 From: XA Date: Sun, 1 Sep 2024 20:21:51 -0500 Subject: [PATCH] fix(actions): add proper branch references (#3) Signed-off-by: Akshay Mestry --- .github/workflows/publish-dev-pages.yaml | 2 +- .github/workflows/publish-feature-pages.yaml | 22 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-dev-pages.yaml b/.github/workflows/publish-dev-pages.yaml index 4d21bb4..8cd125c 100644 --- a/.github/workflows/publish-dev-pages.yaml +++ b/.github/workflows/publish-dev-pages.yaml @@ -76,7 +76,7 @@ jobs: # Step 5: Deploy the built HTML files to the specified branch (GitHub Pages). - name: DEV | Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v4 - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' }} with: github_token: ${{ secrets.GITHUB_TOKEN }} # Deploys to the gh-pages branch. publish_branch: ${{ env.PUBLISH_BRANCH }} # Uses the GitHub token for authentication. diff --git a/.github/workflows/publish-feature-pages.yaml b/.github/workflows/publish-feature-pages.yaml index 48dd17f..08ec957 100644 --- a/.github/workflows/publish-feature-pages.yaml +++ b/.github/workflows/publish-feature-pages.yaml @@ -75,3 +75,25 @@ jobs: run: | echo "Building Sphinx documentation..." sphinx-build -EWaq -b html ${{ env.SOURCE_DIR }} ${{ env.OUTPUT_DIR }} + + # Step 5: Deploy the built HTML files to the specified branch (GitHub Pages). + - name: FEAT | Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/feature/') }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} # Deploys to the gh-pages branch. + publish_branch: ${{ env.PUBLISH_BRANCH }} # Uses the GitHub token for authentication. + publish_dir: ${{ env.OUTPUT_DIR }} # Directory to publish (the output of the Sphinx build). + force_orphan: false # Do not force an orphan commit, preserving commit history. + enable_jekyll: false # Disables Jekyll processing on GitHub Pages, which is unnecessary for Sphinx-generated HTML. + user_email: "github-actions[bot]@users.noreply.github.com" # Email to associate with the commit. + user_name: "github-actions[bot]" # Name to associate with the commit. + full_commit_message: ${{ github.event.head_commit.message }} # Use the commit message from the push event. + + # Step 6: Provide response after deployment. + - name: Notify Success + if: success() + run: echo "✅ Documentation successfully built and deployed to GitHub Pages (Dev)." + - name: Notify Failure + if: failure() + run: echo "❌ Failed to build or deploy the documentation from the dev branch. Please check the logs."