Skip to content
Merged
Show file tree
Hide file tree
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
60 changes: 32 additions & 28 deletions .github/workflows/docs-deploy.yml
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have 3 workflows that build docs, 2 of them also publish the docs to different places. Can we merge these into a reusable workflow and call that from CI, releases, and the web UI?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's what I felt when I was trying to fix this.
But I felt it would be complicated to get right first time, and I did not want this to block releases for the other packages.
So we can fix as a follow-up?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Can you open an issue?

Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,60 @@ name: Deploy docs

on:
workflow_dispatch:
inputs:
package:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to use a choice type here (https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#onworkflow_dispatchinputs) That way, the caller can't make a typo. But we would have to maintain the list as we add packages.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had a list before, so I think it would be ok to have a choice here? especially if it translates to a dropdown menu in the web ui?

required: true
description: 'Select which package to build docs for'
type: choice
options:
- essreduce
- essimaging
- essnmx
publish:
default: false
type: boolean
branch:
description: 'Branch/tag with documentation source. If not set, the main branch will be used.'
default: 'main'
required: false
type: string

jobs:
docs:
name: Build and deploy docs
runs-on: ubuntu-24.04
permissions:
contents: write
strategy:
matrix:
package: [essreduce, essimaging, essnmx]
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.branch }}
fetch-depth: 0
- uses: prefix-dev/setup-pixi@v0.9.4
with:
frozen: true
environments: docs-${{ matrix.package }}
environments: docs-${{ inputs.package }}
- name: Build docs
run: pixi run -e docs-${{ matrix.package }} docs ${{ matrix.package }}
- uses: actions/upload-artifact@v4
with:
name: docs-${{ matrix.package }}
path: packages/${{ matrix.package }}/html

deploy:
name: Deploy site
needs: docs
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v4
with:
path: site
pattern: docs-*
merge-multiple: false
run: pixi run docs-${{ inputs.package }}}}
- name: Prepare site
if: ${{ inputs.publish }}
run: |
mkdir -p gh-pages-site
for dir in site/docs-*; do
package="${dir#site/docs-}"
cp -r "$dir" "gh-pages-site/$package"
done
PACKAGE=${{ inputs.package }}
git fetch origin gh-pages:gh-pages || true
git worktree add gh-pages-site gh-pages || mkdir -p gh-pages-site
rm -rf gh-pages-site/$PACKAGE
cp -r packages/$PACKAGE/html gh-pages-site/$PACKAGE
cp docs/index.html gh-pages-site/index.html
touch gh-pages-site/.nojekyll
- name: Build search index
if: ${{ inputs.publish }}
run: npx pagefind@latest --site gh-pages-site --bundle-dir pagefind
- uses: JamesIves/github-pages-deploy-action@v4
if: ${{ inputs.publish }}
with:
branch: gh-pages
folder: gh-pages-site
- uses: actions/upload-artifact@v4
with:
name: docs-${{ inputs.package }}
path: packages/${{ inputs.package }}/html
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
frozen: true
environments: docs-${{ needs.determine-package.outputs.package }}
- name: Build docs
run: pixi run -e docs-${{ needs.determine-package.outputs.package }} docs ${{ needs.determine-package.outputs.package }}
run: pixi run docs-${{ needs.determine-package.outputs.package }}
- name: Prepare site
run: |
PACKAGE=${{ needs.determine-package.outputs.package }}
Expand Down
Loading