Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add docs site preview #201

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,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
30 changes: 30 additions & 0 deletions .github/workflows/site.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Site
on:
- pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- 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
- id: netlify
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
run: |
preview_url=$(make --silent -C ./docs netlify | tail -n 1 | tr -d '"')
echo "# 🚀 Site Preview" >> $GITHUB_STEP_SUMMARY
echo "$preview_url" >> $GITHUB_STEP_SUMMARY
33 changes: 24 additions & 9 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,48 @@
.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
NETLIFY_SITE_ID ?= 5cea1f56-7935-4387-975a-18a7905d15ee
CURRENT_YEAR ?= $(shell date +%Y)
VERSION ?= $(shell make --silent -C ../ version | tail -n 1)

.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


netlify:
NETLIFY_SITE_ID=$(NETLIFY_SITE_ID) npx -y netlify-cli deploy --dir _site --json | jq '.deploy_url'
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
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pandas
pre-commit
pyjson5
pytest
quartodoc
rsconnect
responses
ruff
Expand Down
Loading