Skip to content

Commit

Permalink
deploy to GitHub Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mdekstrand committed Jul 3, 2024
1 parent 9a80c8e commit 7902001
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 12 deletions.
40 changes: 34 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Documentation
branches:
- main
pull_request: {}
workflow_dispatch: {}
defaults:
run:
shell: bash -el {0}
Expand Down Expand Up @@ -39,8 +40,8 @@ jobs:
with:
name: lenskit-docs
path: build/doc
publish:
name: Publish documentation
archive:
name: Archive documentation
runs-on: ubuntu-latest
needs:
- build
Expand Down Expand Up @@ -73,7 +74,34 @@ jobs:
git commit -m 'rebuild documentation'
- name: 🛫 Push documentation
run: cd doc-site && git push
- name: 🏃🏻‍➡️ Trigger publication workflow
run: cd doc-site && gh workflow run publish.yml --ref main
env:
GH_TOKEN: ${{secrets.LKBOT_TOKEN}}
publish:
name: Publish documentation
runs-on: ubuntu-latest
needs:
- archive
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Check out doc site
uses: actions/checkout@v4
with:
repository: lenskit/lenskit-docs
ref: main
- name: Set up Deno
uses: denoland/setup-deno@v1
with:
deno-version: ~1.44
- name: Set up Just
uses: extractions/setup-just@v2
- name: Build site content
run: just build
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
46 changes: 40 additions & 6 deletions lkdev/workflows/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def workflow():
"branches": ["main"],
},
"pull_request": {},
"workflow_dispatch": {},
},
"defaults": {
"run": {
Expand All @@ -24,7 +25,8 @@ def workflow():
},
"jobs": {
"build": job_build_docs(),
"publish": job_publish_docs(),
"archive": job_archive_docs(),
"publish": job_publish_site(),
},
}

Expand Down Expand Up @@ -83,9 +85,9 @@ def stages_package():
]


def job_publish_docs():
def job_archive_docs():
return {
"name": "Publish documentation",
"name": "Archive documentation",
"runs-on": "ubuntu-latest",
"needs": ["build"],
"environment": "docs",
Expand Down Expand Up @@ -125,10 +127,42 @@ def job_publish_docs():
"name": "🛫 Push documentation",
"run": "cd doc-site && git push",
},
],
}


def job_publish_site():
return {
"name": "Publish documentation",
"runs-on": "ubuntu-latest",
"needs": ["archive"],
"environment": {"name": "github-pages", "url": "${{ steps.deployment.outputs.page_url }}"},
"steps": [
{
"name": "Check out doc site",
"uses": "actions/checkout@v4",
"with": {
"repository": "lenskit/lenskit-docs",
"ref": "main",
},
},
{
"name": "Set up Deno",
"uses": "denoland/setup-deno@v1",
"with": {"deno-version": "~1.44"},
},
{"name": "Set up Just", "uses": "extractions/setup-just@v2"},
{"name": "Build site content", "run": "just build"},
{"name": "Setup Pages", "uses": "actions/configure-pages@v5"},
{
"name": "Upload artifact",
"uses": "actions/upload-pages-artifact@v3",
"with": {"path": "site"},
},
{
"name": "🏃🏻‍➡️ Trigger publication workflow",
"run": "cd doc-site && gh workflow run publish.yml --ref main",
"env": {"GH_TOKEN": "${{secrets.LKBOT_TOKEN}}"},
"name": "Deploy to GitHub Pages",
"id": "deployment",
"uses": "actions/deploy-pages@v4",
},
],
}

0 comments on commit 7902001

Please sign in to comment.