Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update publish workflow #558

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ concurrency:
group: docs
cancel-in-progress: true

permissions:
contents: write

jobs:
build-and-deploy:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -105,18 +108,26 @@ jobs:
run: |
jq -s '.[0] + .[1]' _site/search_original.json fixed_main_search.json > _site/search.json

- name: Deploy versioned docs
uses: JamesIves/github-pages-deploy-action@v4
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
branch: gh-pages
folder: _site
target-folder: versions/${{ env.version }}
clean: false
ref: gh-pages
path: ../gh-pages

- name: Deploy latest docs to root
if: env.version == env.LATEST
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: _site
clean: false
- name: Update gh-pages branch
run: |
# Copy to versions/ subdirectory
mkdir -p ../gh-pages/versions/${{ env.version }}
cp -r _site/* ../gh-pages/versions/${{ env.version }}

# Find the latest version of the docs and copy that to the root
cd ../gh-pages/versions
LATEST_DOCS=$(ls -d * | sort -V | tail -n 1)
cp -r $LATEST_DOCS/* ../

# Commit and push
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Publish docs @ ${GITHUB_REPOSITORY}@${GITHUB_SHA}"
git push
Loading