-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use GitHub Actions to deploy nimble guide. (#1197)
- Loading branch information
1 parent
45e4ba8
commit 734f5d7
Showing
8 changed files
with
96 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: GitHub Pages | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'nimble-guide/**' | ||
workflow_dispatch: | ||
|
||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
cache: 'pip' # caching pip dependencies | ||
- run: pip install -r nimble-guide/requirements.txt | ||
|
||
- name: Build Docs | ||
run: mkdocs build -f nimble-guide/mkdocs.yml | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: ./nimble-guide/site | ||
|
||
deploy: | ||
needs: build | ||
permissions: | ||
pages: write | ||
id-token: write | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Nimble Guide | ||
|
||
## Contributing | ||
|
||
In order to preview changes to the guide you will need to have `python` installed. | ||
With python you should generate a local `venv` and install `mkdocs-material`: | ||
|
||
```sh | ||
python -m venv .venv && ./.venv/bin/pip install -r ./requirements.txt | ||
source ./.venv/bin/activate | ||
mkdocs serve | ||
``` | ||
|
||
To automate `venv` usage and `mkdocs` install you can use the tasks defined in [`config.nims`](./config.nims) and just run: | ||
|
||
```sh | ||
nim serve | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import std/[os, strformat] | ||
|
||
const | ||
binDir = when defined(windows): "Scripts" else: "bin" | ||
python = toExe("python") | ||
pip = ".venv" / binDir / toExe("pip") | ||
mkdocs = ".venv" / binDir / toExe("mkdocs") | ||
|
||
task bootstrap, "set up mkdocs": | ||
exec fmt"{python} -m venv .venv" | ||
exec fmt"{pip} install -r requirements.txt" | ||
|
||
proc ensureMkdocs() = | ||
if not fileExists mkdocs: | ||
echo "no mkdocs found, generating local venv" | ||
bootstrapTask() | ||
|
||
task serve, "serve guide w/mkdocs": | ||
ensureMkdocs() | ||
exec fmt"{mkdocs} serve" | ||
|
||
task build, "build guide w/mkdocs": | ||
ensureMkdocs() | ||
exec fmt"{mkdocs} build" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mkdocs-material>=9.5 |