From 0239bfc8e11fbc7752137c3d4979f59d7cd77fbe Mon Sep 17 00:00:00 2001 From: Esoteric Enderman Date: Wed, 5 Feb 2025 15:46:29 +0000 Subject: [PATCH] Attempt to fix dokka.yml --- .github/workflows/dokka.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dokka.yml b/.github/workflows/dokka.yml index 005cad4..ac37f0c 100644 --- a/.github/workflows/dokka.yml +++ b/.github/workflows/dokka.yml @@ -32,13 +32,16 @@ jobs: run: gradle dokkaJavadoc - name: Generate Dokka GFM files run: gradle dokkaGfm + - name: Deploy to GitHub Pages + if: github.ref == 'refs/heads/main' + run: | - name: Deploy to GitHub Pages if: github.ref == 'refs/heads/main' run: | git config --global user.name "GitHub Actions" git config --global user.email "actions@github.com" - # Check if gh-pages branch exists remotely + # Check if gh-pages exists remotely, otherwise create it if ! git ls-remote --exit-code --heads origin gh-pages; then git checkout --orphan gh-pages git rm -rf . @@ -47,10 +50,14 @@ jobs: git add README.md git commit -m "Initial commit for GitHub Pages" git push origin gh-pages + git checkout main # Return to main branch before adding worktree fi - # Use a separate directory for the gh-pages worktree - git worktree add gh-pages-dir gh-pages + # Ensure the worktree does not already exist + rm -rf gh-pages-dir + + # Add gh-pages as a worktree + git worktree add gh-pages-dir origin/gh-pages # Ensure it's clean rm -rf gh-pages-dir/*