-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #59
- Loading branch information
Showing
4 changed files
with
52 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ on: | |
push: | ||
branches: | ||
- master | ||
- release/* | ||
- release/2* | ||
pull_request: | ||
workflow_dispatch: | ||
inputs: | ||
|
@@ -27,8 +27,11 @@ jobs: | |
persist-credentials: false | ||
fetch-depth: 0 | ||
|
||
- name: Setup Just | ||
uses: extractions/setup-just@v2 | ||
|
||
- name: Build docs | ||
run: make build | ||
run: just build | ||
|
||
- name: Deploy preview to Netlify | ||
uses: nwtgck/actions-netlify@v2 | ||
|
@@ -46,13 +49,13 @@ jobs: | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | ||
timeout-minutes: 5 | ||
|
||
- name: Build versioned docs | ||
# TODO support publishing non-dev versions | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
- name: Publish versioned docs | ||
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/2')) | ||
env: | ||
PUSH_TOKEN: ${{ secrets.GH_DEPLOY_PUSH_TOKEN }} | ||
run: | | ||
make deploy RELEASE=dev ALIAS=master | ||
just deploy | ||
just list | ||
git push https://[email protected]/${{ github.repository }} publish | ||
- name: Setup tmate session for debug | ||
|
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 @@ | ||
set shell := ["bash", "-euo", "pipefail", "-c"] | ||
|
||
[private] | ||
@default: build | ||
|
||
export DOCKER_CLI_HINTS := "false" | ||
|
||
image_name := "ghcr.io/githedgehog/hhdocs" | ||
image_version := "20241202" | ||
image := image_name + ":" + image_version | ||
|
||
# Run mkdocs or mike CLI in a container | ||
_run +cmd: | ||
docker run -q --pull=always --rm -v $(pwd):/docs -p 8000:8000 {{image}} {{cmd}} | ||
|
||
# Build docs site (unversioned) | ||
build: (_run "mkdocs build") | ||
|
||
# Clean generated docs site | ||
clean: | ||
rm -rf site | ||
|
||
# Serve docs site (unversioned, watches for changes) | ||
serve: (_run "mkdocs serve -a 0.0.0.0:8000") | ||
|
||
# List published versions | ||
list: (_run "mike list -b publish") | ||
|
||
branch_current := `git branch --show-current --format "%(refname:short)"` | ||
branch_latest := `git branch --list 'release/2*' --format "%(refname:short)" --sort=-version:refname | head -n 1` | ||
release := trim_start_match(branch_current, "release/") | ||
|
||
_release := if branch_current == "master" { "dev" } else { release } | ||
_alias := if branch_current == branch_latest { "latest" } else if branch_current == "master" { "master" } else { "" } | ||
|
||
# Shoud version that will be deployed (to publish branch) | ||
@version: | ||
echo "Release '{{_release}}' alias '{{_alias}}'" | ||
|
||
# Deploy docs site (versioned) to publish branch | ||
deploy release=_release alias=_alias: (_run "mike deploy -b publish -u" release alias) |
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