Skip to content

Commit a0ede5b

Browse files
committed
Update documentation.yml
Switch to git corktree rather than creating a new repository.
1 parent c777638 commit a0ede5b

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

.github/workflows/documentation.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,29 @@ jobs:
4949
fileName: swift-doc.exe
5050
out-file-path: C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\
5151

52+
- name: Prepare
53+
run: |
54+
git config user.email "${{ github.actor }}@users.noreply.github.com"
55+
git config user.name "Swift/Win32"
56+
git worktree add --no-checkout --detach site
57+
git -C site remote rm origin
58+
git -C site remote add origin "https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }}"
59+
git -C site checkout --orphan gh-pages
60+
git -C site reset --hard
61+
5262
- name: Generate Documentation
5363
run: |
54-
New-Item -Path . -Name root -ItemType Directory
55-
git -C root init
56-
git -C root config --local user.email "${{ github.actor }}@users.noreply.github.com"
57-
git -C root config --local user.name "Swift/Win32"
58-
git -C root remote add origin origin "https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }}"
59-
swift doc generate Sources\SwiftWin32\CG --module-name CoreGraphics --output root\CoreGraphics --format html --base-url https://compnerd.github.io/swift-win32/CoreGraphics
60-
swift doc generate Sources\SwiftWin32 --module-name SwiftWin32 --output root\SwiftWin32 --format html --base-url https://compnerd.github.io/swift-win32/SwiftWin32
61-
swift doc generate Sources\SwiftWin32UI --module-name SwiftWin32UI --output root\SwiftWin32UI --format html --base-url https://compnerd.github.io/swift-win32/SwiftWin32UI
62-
git -C root add --all
63-
git -C root commit -m "refresh content"
64-
git -C root push origin "+HEAD:refs/heads/gh-pages"
64+
New-Item -Path . -Name site -ItemType Directory
65+
swift doc generate Sources\SwiftWin32\CG --module-name CoreGraphics --output site\CoreGraphics --format html --base-url https://compnerd.github.io/swift-win32/CoreGraphics
66+
swift doc generate Sources\SwiftWin32 --module-name SwiftWin32 --output site\SwiftWin32 --format html --base-url https://compnerd.github.io/swift-win32/SwiftWin32
67+
swift doc generate Sources\SwiftWin32UI --module-name SwiftWin32UI --output site\SwiftWin32UI --format html --base-url https://compnerd.github.io/swift-win32/SwiftWin32UI
68+
69+
- name: Deploy
70+
run: |
71+
git -C site add --all
72+
git -C site commit --quiet --no-verify -m "${{ github.repository }}@${{ github.sha }}"
73+
git -C site push origin --force-with-lease HEAD:refs/heads/gh-pages
74+
75+
- name: Cleanup
76+
run: |
77+
git worktree remove --force site

0 commit comments

Comments
 (0)