Skip to content

Commit

Permalink
ci: add docs site preview
Browse files Browse the repository at this point in the history
  • Loading branch information
tdstein committed Jun 10, 2024
1 parent 50b795f commit a73b2e5
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 24 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,3 @@ jobs:
cache: 'pip'
- run: make deps
- run: make build

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
check-latest: true
cache: 'pip'
- uses: quarto-dev/quarto-actions/setup@v2
- run: make deps
- run: make dev
- run: make docs
29 changes: 29 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Documentation
on:
- pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
default:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
check-latest: true
cache: 'pip'
- uses: quarto-dev/quarto-actions/setup@v2
- run: make deps
- run: make dev
- run: make docs
- uses: actions/setup-node@v4
- run: npm install -g netlify
- run: netlify help
- uses: quarto-dev/quarto-actions/publish@v2
with:
target: netlify
path: docs
render: false
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
28 changes: 19 additions & 9 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,43 @@
.DEFAULT_GOAL := all

# Command aliases
QUARTO=quarto
QUARTODOC=quartodoc
PIP ?= pip3
QUARTO ?= quarto
QUARTODOC ?= quartodoc

# Environment variables
CURRENT_YEAR := $(shell date +%Y)
VERSION := $(shell make -C ../ version)
export CURRENT_YEAR VERSION
CURRENT_YEAR ?= $(shell date +%Y)
VERSION ?= $(shell make -C ../ version)

.PHONY: clean build deps preview
.PHONY: all \
api \
build \
clean \
deps \
preview

all: deps api build

api: deps
api:
$(QUARTODOC) build
$(QUARTODOC) interlinks
cp -r _extensions/ reference/_extensions # Required to render footer

build: api
build:
CURRENT_YEAR=$(CURRENT_YEAR) \
VERSION=$(VERSION) \
$(QUARTO) render

clean:
rm -rf _extensions _inv _site .quarto reference objects.json
find . -type d -empty -delete

deps:
$(PIP) install --upgrade pip -r requirements-site.txt
$(QUARTO) add --no-prompt posit-dev/[email protected]
$(QUARTO) add --no-prompt machow/quartodoc

preview: api
preview:
CURRENT_YEAR=$(CURRENT_YEAR) \
VERSION=$(VERSION) \
$(QUARTO) preview
4 changes: 4 additions & 0 deletions docs/_publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- source: project
netlify:
- id: "5cea1f56-7935-4387-975a-18a7905d15ee"
url: "https://posit-sdk-py.netlify.app"
3 changes: 3 additions & 0 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
project:
type: website

execute:
freeze: auto

website:
title: "Posit SDK <small>{{< env VERSION >}}</small>"
bread-crumbs: true
Expand Down
2 changes: 2 additions & 0 deletions docs/requirements-site.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

quartodoc
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pandas
pre-commit
pyjson5
pytest
quartodoc
rsconnect
responses
ruff
setuptools
Expand Down

0 comments on commit a73b2e5

Please sign in to comment.