File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,11 +82,13 @@ jobs:
8282
8383 - name : Initialize gh-pages if needed
8484 run : |
85- if [ ! -d "gh-pages" ]; then
85+ if [ ! -d "gh-pages/.git" ]; then
86+ rm -rf gh-pages
8687 mkdir -p gh-pages
8788 cd gh-pages
8889 git init
8990 git checkout -b gh-pages
91+ git remote add origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
9092 fi
9193
9294 - name : Prepare versioned documentation
@@ -145,9 +147,16 @@ jobs:
145147 cd gh-pages
146148 git config user.name "github-actions[bot]"
147149 git config user.email "github-actions[bot]@users.noreply.github.com"
150+
151+ # Set remote URL with token for authentication
152+ git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" 2>/dev/null || \
153+ git remote add origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
154+
148155 git add -A
149156 git diff --staged --quiet || git commit -m "Deploy documentation: ${{ steps.version.outputs.deploy_path }}"
150- git push origin gh-pages --force
157+
158+ # Push, creating the branch if it doesn't exist
159+ git push -u origin gh-pages --force
151160 env :
152161 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
153162
You can’t perform that action at this time.
0 commit comments