File tree Expand file tree Collapse file tree 1 file changed +22
-5
lines changed
Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Original file line number Diff line number Diff line change 4242
4343 - name : Deploy to GitHub Pages
4444 uses : peaceiris/actions-gh-pages@v3
45- with :
46- github_token : ${{ secrets.GITHUB_TOKEN }}
47- publish_dir : ./docs/book
48- publish_branch : gh-pages
49- force_orphan : true
45+ run : |
46+ git config user.name "github-actions[bot]"
47+ git config user.email "github-actions[bot]@users.noreply.github.com"
48+
49+ BRANCH_NAME=${GITHUB_REF#refs/heads/}
50+ SAFE_BRANCH_NAME=$(echo "$BRANCH_NAME" | tr '/' '-')
51+
52+ git clone --depth=1 --branch gh-pages https://github.com/${{ github.repository }} gh-pages || \
53+ git clone --depth=1 https://github.com/${{ github.repository }} gh-pages && \
54+ cd gh-pages && \
55+ git checkout --orphan gh-pages
56+
57+ cd gh-pages
58+
59+ rm -rf "$SAFE_BRANCH_NAME"
60+ mkdir -p "$SAFE_BRANCH_NAME"
61+
62+ cp -r ../docs/book/* "$SAFE_BRANCH_NAME/"
63+
64+ git add "$SAFE_BRANCH_NAME"
65+ git commit -m "Update docs for branch $BRANCH_NAME" || echo "No changes to commit"
66+ git push origin gh-pages
You can’t perform that action at this time.
0 commit comments