Skip to content

Commit

Permalink
Configure GHA to build and deploy umbrella website to GitHub Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
eecavanna committed Sep 4, 2024
1 parent 5b75ad2 commit ea8ce56
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/compile-legacy-nmdc-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: pip install -r requirements.txt
- name: Compile source documents into HTML
run: sphinx-build -b html src ${{ github.workspace }}/legacy/nmdc-documentation/_build/html
# Upload the result as an "artifact" so it can then be downloaded and used by another (TBD) job.
# Upload the result as an "artifact" so it can then be downloaded and used by another job.
- name: Save the HTML for publishing later # Docs: https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v4
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: pip install -r requirements.txt
- name: Compile source documents into HTML
run: sphinx-build -b html src ${{ github.workspace }}/legacy/workflow-documentation/_build/html
# Upload the result as an "artifact" so it can then be downloaded and used by another (TBD) job.
# Upload the result as an "artifact" so it can then be downloaded and used by another job.
- name: Save the HTML for publishing later # Docs: https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v4
with:
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/deploy-to-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This GitHub Actions workflow creates a production build of the website and deploys it to GitHub Pages.
# Reference: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions
name: Build and deploy to GitHub Pages

on:
push: { branches: [ main ] }
workflow_dispatch: { }

# Reference: https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: github-pages
cancel-in-progress: true

jobs:
# Use existing workflows to compile the legacy documentation.
# Reference: https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow
compile-legacy-nmdc-documentation:
name: Compile legacy NMDC documentation
uses: ./.github/workflows/compile-legacy-nmdc-documentation.yml
compile-legacy-workflow-documentation:
name: Compile legacy workflow documentation
uses: ./.github/workflows/compile-legacy-workflow-documentation.yml

build:
name: Compile main website
# This job depends upon other jobs succeeding.
# Reference: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds
needs:
- compile-legacy-nmdc-documentation
- compile-legacy-workflow-documentation
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out commit # Docs: https://github.com/actions/checkout
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4 # Docs: https://github.com/actions/download-artifact
with:
path: artifacts
- name: Assemble website file tree
run: |
ls -R artifacts
mkdir -p _build/html
cp -R artifacts/legacy-nmdc-documentation-as-html _build/html/legacy/nmdc-documentation
cp -R artifacts/legacy-workflow-documentation-as-html _build/html/legacy/workflow-documentation
cp content/index.html _build/html/index.html
- name: Save the result for publishing to GitHub Pages # Docs: https://github.com/actions/upload-pages-artifact
uses: actions/upload-pages-artifact@v3
with:
path: _build/html

deploy:
name: Deploy website
needs:
- build
runs-on: ubuntu-latest
# Reference: https://github.com/actions/deploy-pages
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
# Reference: https://github.com/actions/deploy-pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Empty file added content/.gitignore
Empty file.
14 changes: 14 additions & 0 deletions content/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Docs</title>
</head>
<body>
<ul>
<li><a href="legacy/nmdc-documentation">legacy/nmdc-documentation</a></li>
<li><a href="legacy/workflow-documentation">legacy/workflow-documentation</a></li>
</ul>
</body>
</html>
Empty file added src/.gitignore
Empty file.

0 comments on commit ea8ce56

Please sign in to comment.