Skip to content
Draft
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
55 changes: 0 additions & 55 deletions .github/workflows/_docs.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/_release.yml

This file was deleted.

39 changes: 27 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: CI

on:
push:
branches:
- main
tags:
- '*'
pull_request:
push:
branches: [main]
tags: ["*"] # '*' never matches '/', so e.g. release/x tags don't build

jobs:
lint:
Expand All @@ -19,10 +17,13 @@ jobs:
with:
runs-on: ubuntu-latest

docs:
uses: ./.github/workflows/_docs.yml
permissions:
contents: write
docs: # Call the docs building workflow directly
uses: DiamondLightSource/myst-version-switcher-plugin/.github/workflows/docs.yml@v0.24.1
with:
# Whatever turns your sources into docs/_build/html at $BASE_URL. uv and Node
# are preinstalled; so: make docs · tox -e docs · npm ci && npm run docs
build-command: uv run --locked tox -e docs
html-dir: build/html

example:
needs: test
Expand All @@ -33,7 +34,21 @@ jobs:

release:
needs: [test, docs]
if: github.ref_type == 'tag'
uses: ./.github/workflows/_release.yml
if: github.ref_type == 'tag' # tag pushes only
uses: DiamondLightSource/myst-version-switcher-plugin/.github/workflows/release.yml@v0.24.1
permissions:
contents: write # create the Release + attach assets

publish:
needs: [docs]
# don't publish a pages site in the fork's org
if: github.repository == 'DiamondLightSource/python-copier-template' && github.ref_type == 'tag' # publish only on tags
uses: ./.github/workflows/publish-dispatch.yml # your workflow (below)
with:
version-name: ${{ needs.docs.outputs.version-name }}
permissions:
contents: write
contents: read
actions: write
pages: write
id-token: write
statuses: write
36 changes: 36 additions & 0 deletions .github/workflows/publish-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# .github/workflows/publish-dispatch.yml
name: Publish (dispatch)
on:
workflow_call: # ci.yml's `publish` job, for every event
inputs:
version-name: {required: false, default: "", type: string}
# tag re-dispatch + fork-PR preview + manual re-deploy
workflow_dispatch:
inputs:
pr:
description: "Fork PR to approve + preview (empty = re-deploy)"
required: false
default: ""
retry-until:
description: "Internal = epoch-second retry deadline. Don't set manually."
required: false
default: ""

jobs:
publish:
uses: DiamondLightSource/myst-version-switcher-plugin/.github/workflows/publish.yml@v0.24
with:
# "" on dispatch → pure durable gather
version-name: ${{ inputs.version-name }}
# set (dispatch) → pin that fork head SHA
pr: ${{ inputs.pr }}
# the file the tag re-dispatch re-fires
dispatch-workflow: publish-dispatch.yml
# forwarded so the re-dispatch job's auto-retry can re-fire this shim
retry-until: ${{ inputs.retry-until }}
permissions:
contents: read
actions: write
pages: write
id-token: write
statuses: write
17 changes: 4 additions & 13 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

import os
import sys
from importlib.metadata import version
from pathlib import Path
from subprocess import check_output

import requests

Expand All @@ -19,14 +17,7 @@
# The full version, including alpha/beta/rc tags.
release = version(project)

# The short X.Y version.
if "+" in release:
# Not on a tag, use branch name
root = Path(__file__).absolute().parent.parent
git_branch = check_output("git branch --show-current".split(), cwd=root)
version = git_branch.decode().strip()
else:
version = release
version = os.environ.get("VERSION_NAME", "local")

extensions = [
# For graphviz diagrams
Expand Down Expand Up @@ -135,8 +126,8 @@
"json_url": switcher_json,
"version_match": version,
},
"check_switcher": True,
"navbar_end": ["theme-switcher", "icon-links", "version-switcher"],
"check_switcher": False,
"navbar_end": ["theme-switcher", "navbar-icon-links", "version-switcher"],
}

# A dictionary of values to pass into the template engine’s context for all pages
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ build-backend = "setuptools.build_meta"

[project]
name = "python-copier-template"
description = "Diamond's opinionated copier template for pure Python projects."
dynamic = ["version"]
readme = "README.md"
requires-python = ">=3.11"

[dependency-groups]
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: CI

on:
push:
branches:
- main
tags:
- '*'
pull_request:

push:
branches:[main]
tags:['*']

jobs:

lint:
Expand Down Expand Up @@ -37,10 +35,13 @@ jobs:
packages: write
{% endraw %}{% endif %}{% if sphinx %}
docs:
uses: ./.github/workflows/_docs.yml
permissions:
contents: write
{% endif %}
uses: DiamondLightSource/myst-version-switcher-plugin/.github/workflows/docs.yml@v0.24.1
with:
# Whatever turns your sources into docs/_build/html at $BASE_URL.
# uv and Node are preinstalled; so: make docs · tox -e docs · npm ci && npm run docs
build-command: uv run --locked tox -e docs
html-dir: build/html
{% endif %}
dist:
uses: ./.github/workflows/_dist.yml
{% if pypi %}
Expand All @@ -54,6 +55,20 @@ jobs:
release:
needs: [dist, test{% if sphinx %}, docs{% endif %}]
if: github.ref_type == 'tag'
uses: ./.github/workflows/_release.yml
uses: DiamondLightSource/myst-version-switcher-plugin/.github/workflows/release.yml@v0.24.1
permissions:
contents: write
{% if sphinx %}{% raw %}
publish:
needs: [docs]
if: github.repository == 'DiamondLightSource/python-copier-template' && github.ref_type == 'tag' #publish only on tags
uses: ./.github/workflows/publish-dispatch.yml # your workflow (below)
with:
version-name: ${{ needs.docs.outputs.version-name }}
permissions:
contents: read
actions: write
pages: write
id-token: write
statuses: write
{% endraw %}{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# .github/workflows/publish-dispatch.yml
name: Publish (dispatch)
on:
workflow_call: # ci.yml's `publish` job, for every event
inputs:
version-name: {required: false, default: "", type: string}
# tag re-dispatch + fork-PR preview + manual re-deploy
workflow_dispatch:
inputs:
pr:
description: "Fork PR to approve + preview (empty = re-deploy)"
required: false
default: ""
retry-until:
description: "Internal = epoch-second retry deadline. Don't set manually."
required: false
default: ""

jobs:
publish:
uses: DiamondLightSource/myst-version-switcher-plugin/.github/workflows/publish.yml@v0.24.1
with:
# "" on dispatch → pure durable gather
version-name: ${{ inputs.version-name }}
# set (dispatch) → pin that fork head SHA
pr: ${{ inputs.pr }}
# the file the tag re-dispatch re-fires
dispatch-workflow: publish-dispatch.yml
# forwarded so the re-dispatch job's auto-retry can re-fire this shim
retry-until: ${{ inputs.retry-until }}
permissions:
contents: read
actions: write
pages: write
id-token: write
statuses: write

This file was deleted.

2 changes: 1 addition & 1 deletion template/{% if sphinx %}docs{% endif %}/conf.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ html_theme_options = {
"version_match": version,
},
"check_switcher": False,
"navbar_end": ["theme-switcher", "icon-links", "version-switcher"],
"navbar_end": ["theme-switcher", "navbar-icon-links", "version-switcher"],
"navigation_with_keys": False,
}

Expand Down
Loading
Loading