Skip to content

Commit 2406959

Browse files
authored
build: Use template files for creating extensions; Publish website (#16)
1 parent 7206242 commit 2406959

File tree

5 files changed

+143
-19
lines changed

5 files changed

+143
-19
lines changed

.github/workflows/website.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
workflow_dispatch:
3+
push:
4+
branches:
5+
- main
6+
- docs-**
7+
pull_request:
8+
9+
name: Website
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out repository
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Quarto
19+
uses: quarto-dev/quarto-actions/setup@v2
20+
21+
- name: Render Quarto Project
22+
uses: quarto-dev/quarto-actions/render@v2
23+
24+
- name: Upload static files as artifact
25+
id: deployment
26+
uses: actions/upload-pages-artifact@v3
27+
with:
28+
path: _site/
29+
30+
deploy:
31+
if: github.event_name == 'push'
32+
needs: build
33+
34+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
35+
permissions:
36+
pages: write # to deploy to Pages
37+
id-token: write # to verify the deployment originates from an appropriate source
38+
39+
# Deploy to the github-pages environment
40+
environment:
41+
name: github-pages
42+
url: ${{ steps.deployment.outputs.page_url }}
43+
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Deploy to GitHub Pages
47+
id: deployment
48+
uses: actions/deploy-pages@v4

Makefile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
.DEFAULT_GOAL := help
2+
3+
# Shell settings
4+
SHELL := /bin/bash
5+
6+
# Use an empty target to force running every time
7+
.PHONY: FORCE
8+
FORCE:
9+
10+
# Quarto
11+
docs: FORCE ## [docs] Generate documentation
12+
@echo "📖 Generating documentation"
13+
quarto render
14+
docs-preview: FORCE ## [docs] Watch documentation
15+
@echo "📖 Watching documentation"
16+
quarto preview
17+
18+
# Creating extensions
19+
DIR:=
20+
create-extension: ## [ext] Create extension folder
21+
@if [ -z "$(DIR)" ]; then \
22+
echo 'Please provide a directory name using `make create-extension DIR="my_dir"'; \
23+
exit 1; \
24+
fi
25+
@# If the directory contains a slash, error
26+
@if echo $(DIR) | grep -q '/'; then \
27+
echo 'Please provide a directory name without a slash'; \
28+
exit 1; \
29+
fi
30+
@# If the directory already exists, error
31+
@if [ -d "extensions/$(DIR)" ]; then \
32+
echo 'Directory "extensions/$(DIR)" already exists'; \
33+
exit 1; \
34+
fi
35+
36+
@echo "🔧 Creating directory: extensions/$(DIR)"
37+
@mkdir -p "extensions/$(DIR)"
38+
39+
@echo "📝 Copying template files: $(ls -m _template)"
40+
@cp -r _template/* extensions/$(DIR)
41+
42+
@echo ""
43+
@echo "⏳ Remaining Tasks:"
44+
@echo "- [ ] Copy in app files"
45+
@echo "- [ ] Create manifest.json"
46+
47+
48+
# build: FORCE ## [py] Build python package
49+
# @echo "🧳 Building python package"
50+
# @[ -d dist ] && rm -r dist || true
51+
# uv build
52+
53+
54+
55+
help: FORCE ## Show help messages for make targets
56+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; { \
57+
printf "\033[32m%-18s\033[0m", $$1; \
58+
if ($$2 ~ /^\[docs\]/) { \
59+
printf "\033[34m[docs]\033[0m%s\n", substr($$2, 7); \
60+
} else if ($$2 ~ /^\[py\]/) { \
61+
printf " \033[33m[py]\033[0m%s\n", substr($$2, 5); \
62+
} else if ($$2 ~ /^\[ext\]/) { \
63+
printf " \033[35m[ext]\033[0m%s\n", substr($$2, 6); \
64+
} else if ($$2 ~ /^\[r\]/) { \
65+
printf " \033[31m[r]\033[0m%s\n", substr($$2, 4); \
66+
} else { \
67+
printf " %s\n", $$2; \
68+
} \
69+
}'

_template/connect-extension.qmd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
connect-extension.toml
2+
---
3+
title: extension title
4+
categories:
5+
-
6+
---
7+
8+
extension description

_template/connect-extension.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name = "<extension-name>"
2+
title = "<extension-title>"
3+
description = "<extension-categories>"
4+
access_type = "logged_in|acl"

contributing.qmd

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,29 @@ title: Contributing
33
---
44

55
Add your extension in the `extensions/` subdirectory.
6-
In addition to the extension code, include:
76

8-
## `connect-extension.qmd`
7+
To help you get started, call `make create-extension DIR=my_extension_name` to create a new extension directory with the necessary files. Note, you will need to manually create your `manifest.json` file.
98

10-
A file that has the name of your extension, the categories it falls into, and a brief description
9+
<br />
1110

12-
```{filename="connect-extension.qmd"}
13-
---
14-
title: extension title
15-
categories:
16-
-
17-
---
11+
## Required files
12+
13+
### `manifest.json`
14+
15+
Use `rsconnect` or `rsconnect-python` to generate a manifest, which is required as part of the extension bundle
1816

19-
extension description
17+
### `connect-extension.qmd`
2018

19+
A file that has the name of your extension, the categories it falls into, and a brief description
20+
21+
```{filename="connect-extension.qmd"}
22+
{{< include _template/connect-extension.qmd >}}
2123
```
2224

23-
## `connect-extension.toml`
25+
### `connect-extension.toml`
2426

2527
A file with the name, title, a brief description of the extension, and the access type it should have on being created
2628

2729
```{filename="connect-extension.toml"}
28-
name = "<extension-name>"
29-
title = "<extension-title>"
30-
description = "<extension-categories>"
31-
access_type = "logged_in|acl"
30+
{{< include _template/connect-extension.toml >}}
3231
```
33-
34-
## `manifest.json`
35-
36-
Use `rsconnect` or `rsconnect-python` to generate a manifest, which is required as part of the extension bundle

0 commit comments

Comments
 (0)