Skip to content

Commit

Permalink
Set docs workflow swift version to 5.10.
Browse files Browse the repository at this point in the history
  • Loading branch information
furby-tm committed Jul 2, 2024
1 parent ac14f66 commit 29f8555
Showing 1 changed file with 45 additions and 40 deletions.
85 changes: 45 additions & 40 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,49 @@ on:

jobs:
update-docs:

runs-on: ubuntu-latest

name: PixarUSD API Swift ${{ matrix.swift }} on ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
swift: ["5.10"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: fwal/setup-swift@v1
- name: Compile Docs
run: |
set -eux
git config user.email "[email protected]"
git config user.name "furby™"
git fetch
git worktree add --checkout gh-pages origin/gh-pages
export DOCC_JSON_PRETTYPRINT="YES"
export SWIFTPM_ENABLE_COMMAND_PLUGINS=1
swift package \
--allow-writing-to-directory gh-pages/docs \
generate-documentation \
--target PixarUSD \
--disable-indexing \
--transform-for-static-hosting \
--output-path gh-pages/docs
CURRENT_COMMIT_HASH=`git rev-parse --short HEAD`
cd gh-pages
# Inject our site at the index
rm docs/index.html
rm docs/favicon.ico
cp index.html docs
cp favicon.ico docs
cp CNAME docs
cp css/main.css docs/css
cp -R image docs
git add docs
# Commit changes
if [ -n "$(git status --porcelain)" ]; then
echo "Documentation changes found. Commiting the changes to the 'gh-pages' branch and pushing to origin."
git commit -m "Update GitHub Pages documentation site to '$CURRENT_COMMIT_HASH'."
git push origin HEAD:gh-pages
else
echo "No documentation changes found."
fi
- uses: swift-actions/setup-swift@v2
with:
swift-version: ${{ matrix.swift }}
- uses: actions/checkout@v2
- name: Compile Docs
run: |
set -eux
git config user.email "[email protected]"
git config user.name "furby™"
git fetch
git worktree add --checkout gh-pages origin/gh-pages
export DOCC_JSON_PRETTYPRINT="YES"
export SWIFTPM_ENABLE_COMMAND_PLUGINS=1
swift package \
--allow-writing-to-directory gh-pages/docs \
generate-documentation \
--target PixarUSD \
--disable-indexing \
--transform-for-static-hosting \
--output-path gh-pages/docs
CURRENT_COMMIT_HASH=`git rev-parse --short HEAD`
cd gh-pages
# Inject our site at the index
rm docs/index.html
rm docs/favicon.ico
cp index.html docs
cp favicon.ico docs
cp CNAME docs
cp css/main.css docs/css
cp -R image docs
git add docs
# Commit changes
if [ -n "$(git status --porcelain)" ]; then
echo "Documentation changes found. Commiting the changes to the 'gh-pages' branch and pushing to origin."
git commit -m "Update GitHub Pages documentation site to '$CURRENT_COMMIT_HASH'."
git push origin HEAD:gh-pages
else
echo "No documentation changes found."
fi

0 comments on commit 29f8555

Please sign in to comment.