Skip to content

Commit d3fcc5c

Browse files
committed
feat: ✨ add hosting provider variable
1 parent 988c490 commit d3fcc5c

File tree

7 files changed

+49
-26
lines changed

7 files changed

+49
-26
lines changed

copier.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ is_seedcase_project:
7373
help: "Is this package part of the Seedcase Project?"
7474
default: "{{ github_user == 'seedcase-project' }}"
7575

76+
hosting_provider:
77+
type: str
78+
help: "What hosting provider will you use for the documentation website?"
79+
choices:
80+
- netlify
81+
- gh-pages
82+
7683
homepage:
7784
type: str
7885
help: "What is the homepage of your project?"

justfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
@_checks: check-spelling check-commits
55
# Test Seedcase and non-Seedcase projects
6-
@_tests: (test "true") (test "false")
6+
@_tests: (test "true" "netlify") (test "false" "netlify") (test "true" "gh-pages") (test "false" "gh-pages")
77
@_builds: build-contributors build-website build-readme
88

99
# Run all build-related recipes in the justfile
@@ -47,10 +47,10 @@ check-commits:
4747
check-spelling:
4848
uvx typos
4949

50-
# Test and check that a Python package can be created from the template
51-
test is_seedcase_project:
50+
# Test that a Python package can be created from the template, with parameters for: `is_seedcase_project` (true or false) and `hosting_provider` (either "gh-pages" or "netlify")
51+
test is_seedcase_project="true" hosting_provider="netlify":
5252
#!/usr/bin/env bash
53-
test_name="test-python-package"
53+
test_name="test-package-{{ hosting_provider }}"
5454
test_dir="$(pwd)/_temp/{{ is_seedcase_project }}/$test_name"
5555
template_dir="$(pwd)"
5656
commit=$(git rev-parse HEAD)
@@ -62,6 +62,7 @@ test is_seedcase_project:
6262
--trust \
6363
--data package_github_repo="first-last/repo" \
6464
--data is_seedcase_project={{ is_seedcase_project }} \
65+
--data hosting_provider={{ hosting_provider }} \
6566
--data author_given_name="First" \
6667
--data author_family_name="Last" \
6768
--data author_email="[email protected]" \
@@ -96,6 +97,7 @@ test is_seedcase_project:
9697
--overwrite \
9798
--data package_github_repo="first-last/repo" \
9899
--data is_seedcase_project={{ is_seedcase_project }} \
100+
--data hosting_provider={{ hosting_provider }} \
99101
--data author_given_name="First" \
100102
--data author_family_name="Last" \
101103
--data author_email="[email protected]" \

template/.github/workflows/build-website.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build website
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
# Limit token permissions for security
9+
permissions: read-all
10+
11+
jobs:
12+
build-website:
13+
uses: seedcase-project/.github/.github/workflows/reusable-build-docs-with-python.yml@main
14+
{%- if hosting_provider == 'gh-pages' %}
15+
with:
16+
hosting-provider: gh-pages
17+
permissions:
18+
contents: write
19+
pages: write
20+
{%- endif %}
21+
secrets:
22+
{% if hosting_provider == 'gh-pages' -%}
23+
github-token: {{ '${{ secrets.GITHUB_TOKEN }}' }}
24+
{%- elif hosting_provider == 'netlify' -%}
25+
netlify-token: {{ '${{ secrets.NETLIFY_AUTH_TOKEN }}' }}
26+
{%- endif %}

template/_publish.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

template/_quarto.yml.jinja

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ project:
1111
website:
1212
# TODO: Fill in the title of the website.
1313
title: ""
14+
{% if hosting_provider == "gh-pages" -%}
15+
site-url: "https://{{ github_user }}.github.io/{{ github_repo }}/"
16+
{%- elif hosting_provider == "netlify" -%}
17+
# TODO: Set the Netlify custom domain URL
1418
site-url: "{{ homepage }}"
19+
{%- endif %}
1520
repo-url: "https://github.com/{{ package_github_repo }}"
1621
page-navigation: true
1722
navbar:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- source: project
2+
netlify:
3+
# TODO: Include correct ID and URL
4+
- id: ""
5+
url: "https://{{ github_user }}-{{ github_repo }}.netlify.app"

0 commit comments

Comments
 (0)