Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/actions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ workflows:
'.github/workflows/check-docs.yml':
- 'actions/checkout@v7.0.1'
- 'actions/setup-python@v7.1.0'
- 'actions/upload-artifact@v7.0.2'
'.github/workflows/codeql.yml':
- 'actions/checkout@v7.0.1'
- 'github/codeql-action@v4.39.3'
Expand Down
25 changes: 19 additions & 6 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ jobs:

- name: Install Dependencies
run: |
python -m pip install --upgrade pip build wheel virtualenv
pip install .[docs,website]
pip install -r packaging/windows/requirements.txt

pip install ".[docs,pyav,moviepy]" -r website/requirements.txt

- name: Check CLI Documentation
shell: bash
Expand All @@ -61,7 +58,23 @@ jobs:
run: |
sphinx-build -W --keep-going -b html docs docs/_build/html

- name: Build MkDocs Website (--strict)
- name: Build Website (--strict)
shell: bash
run: |
python website/build.py --strict

- name: Check Responsive Layout & Capture Screenshots
shell: bash
run: |
mkdocs build --strict -f website/mkdocs.yml
python website/check_layout.py \
--sphinx-dir docs/_build/html \
--screenshots "${RUNNER_TEMP}/website-screenshots"

- name: Upload Website Screenshots
if: always()
uses: actions/upload-artifact@v7.0.2
with:
name: website-screenshots
path: ${{ runner.temp }}/website-screenshots/
if-no-files-found: ignore
retention-days: 14
65 changes: 46 additions & 19 deletions .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ on:
- 'docs/**'
- 'scenedetect/**'
- 'scenedetect.cfg'
- 'website/pages/docs.md'
workflow_dispatch:

concurrency:
group: gh-pages
cancel-in-progress: false

jobs:
update_docs:
runs-on: ubuntu-latest
Expand All @@ -36,32 +41,38 @@ jobs:
cache: 'pip'

- name: Set Destination (Releases)
if: ${{ contains(github.ref_name, 'releases') }}
if: ${{ startsWith(github.ref, 'refs/heads/releases/') }}
shell: bash
env:
REF_NAME: ${{ github.ref_name }}
run: |
echo "scenedetect_docs_dest=$(echo ${{ github.ref_name }} | cut -b 10-)" >> "$GITHUB_ENV"
echo "scenedetect_docs_dest=${REF_NAME#releases/}" >> "$GITHUB_ENV"

- name: Set Destination (Head)
if: ${{ contains(github.ref_name, 'main') }}
if: ${{ github.ref == 'refs/heads/main' }}
shell: bash
run: |
echo "scenedetect_docs_dest=head" >> "$GITHUB_ENV"

- name: Check Destination
if: ${{ env.scenedetect_docs_dest == '' }}
shell: bash
run: |
echo "Failing build: destination must be set!"
exit 1

- name: Setup Environment
run: |
python -m pip install --upgrade pip build wheel virtualenv
pip install .[docs]
pip install -r packaging/windows/requirements.txt
pip install ".[docs,pyav,moviepy]"
git config --global user.name github-actions
git config --global user.email github-actions@github.com

- name: Check CLI Documentation
shell: bash
env:
PYTHONDONTWRITEBYTECODE: "1"
run: |
python docs/generate_cli_docs.py
python -B docs/generate_cli_docs.py
if [[ $(git status --porcelain=1 -- docs | wc -l) -ne 0 ]]; then
git --no-pager diff -- docs
echo 'CLI documentation is out of date: the generated docs do not match the output of docs/generate_cli_docs.py!'
Expand All @@ -70,29 +81,45 @@ jobs:
fi

- name: Generate Docs
shell: bash
env:
PYTHONDONTWRITEBYTECODE: "1"
run: |
sphinx-build -b html docs build
sphinx-build -b html -d "${RUNNER_TEMP}/doctrees" docs "${RUNNER_TEMP}/docs-build"

- name: Update gh-pages Branch
shell: bash
env:
DOCS_DEST: ${{ env.scenedetect_docs_dest }}
run: |
git fetch origin gh-pages
git checkout gh-pages
git rm "docs/${{ env.scenedetect_docs_dest }}" -r -f --ignore-unmatch
git add build/
git mv build "docs/${{ env.scenedetect_docs_dest }}"
git clean -ffdx
git rm "docs/${DOCS_DEST}" -r -f --ignore-unmatch
mkdir -p "docs/${DOCS_DEST}"
cp -a "${RUNNER_TEMP}/docs-build/." "docs/${DOCS_DEST}/"
git add -A "docs/${DOCS_DEST}"

- name: Update Latest
if: ${{ env.scenedetect_docs_dest == env.scenedetect_docs_latest }}
shell: bash
env:
DOCS_DEST: ${{ env.scenedetect_docs_dest }}
run: |
git rm "docs/latest" -r -f --ignore-unmatch
mkdir -p latest
cp -r -f "docs/${{ env.scenedetect_docs_dest }}" docs/latest
git add docs/latest
echo "scenedetect_docs_dest='${{ env.scenedetect_docs_dest }} (latest)'" >> "$GITHUB_ENV"
cp -a "docs/${DOCS_DEST}" docs/latest
git add -A docs/latest
echo "scenedetect_docs_dest=${DOCS_DEST} (latest)" >> "$GITHUB_ENV"

- name: Commit and Push
shell: bash
env:
DOCS_DEST: ${{ env.scenedetect_docs_dest }}
TRIGGER_ACTOR: ${{ github.triggering_actor }}
run: |
git commit -a -m "[docs] @${{ github.triggering_actor }}: Generate Documentation" \
-m "Source: ${{ github.ref_name }} (${{ github.sha }})" \
-m "Destination: ${{ env.scenedetect_docs_dest }}"
git push
if ! git diff --quiet || ! git diff --cached --quiet; then
git commit -a -m "[docs] @${TRIGGER_ACTOR}: Generate Documentation" \
-m "Source: ${GITHUB_REF_NAME} (${GITHUB_SHA})" \
-m "Destination: ${DOCS_DEST}"
git push
fi
117 changes: 98 additions & 19 deletions .github/workflows/generate-website.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@

name: Generate Website

on:
push:
branches:
- main
- 'website/**'
paths:
- 'website/**'
- 'docs/LATEST_VERSION'
- 'docs/_ext/doc_versions.py'
- '.github/workflows/generate-website.yml'
workflow_dispatch:
inputs:
target:
description: 'Deployment target on gh-pages'
required: false
default: 'auto'
type: choice
options:
- auto
- staging
- production
- clear-staging

concurrency:
group: gh-pages
cancel-in-progress: false

jobs:
update_site:
Expand All @@ -19,36 +37,97 @@ jobs:
steps:
- uses: actions/checkout@v7.0.1

- name: Resolve Deployment Target
shell: bash
env:
INPUT_TARGET: ${{ inputs.target || 'auto' }}
run: |
if [[ "${INPUT_TARGET}" == "auto" ]]; then
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
target="production"
else
target="staging"
fi
else
target="${INPUT_TARGET}"
fi

if [[ "$target" == "production" ]] && [[ "${GITHUB_REF}" != "refs/heads/main" ]] && [[ "${GITHUB_REF}" != refs/heads/releases/* ]]; then
echo "Refusing production deployment from non-release ref: ${GITHUB_REF}" >&2
exit 1
fi

if [[ "$target" == "staging" ]]; then
base_path="/staging"
else
base_path=""
fi

echo "deploy_target=${target}" >> "$GITHUB_ENV"
echo "site_base_path=${base_path}" >> "$GITHUB_ENV"
echo "Resolved target=${target} (base_path='${base_path}')"

- name: Set up Python 3.12
if: env.deploy_target != 'clear-staging'
uses: actions/setup-python@v7.1.0
with:
python-version: '3.12'
cache: 'pip'

- name: Install Dependencies
if: env.deploy_target != 'clear-staging'
run: |
python -m pip install --upgrade pip build wheel virtualenv
pip install .[website]
python -m pip install -r website/requirements.txt

- name: Generate Website
- name: Generate Website (--strict)
if: env.deploy_target != 'clear-staging'
shell: bash
run: |
mkdocs build -f website/mkdocs.yml
python -B website/build.py \
--strict \
--base-path "${SITE_BASE_PATH}" \
--out-dir "${RUNNER_TEMP}/site-build"
env:
PYTHONDONTWRITEBYTECODE: "1"
SITE_BASE_PATH: ${{ env.site_base_path }}

- name: Update Website
- name: Update gh-pages Branch
shell: bash
run: |
git fetch origin gh-pages
git checkout gh-pages
git rm * -r -f --ignore-unmatch
git checkout HEAD -- .nojekyll
git checkout HEAD -- CNAME
git checkout HEAD -- docs/
git rm docs/index.html --ignore-unmatch
git add website/build/
git mv website/build/* . -f -k
git mv website/build/docs/index.html docs/index.html -k
git rm website/build/* -r -f --ignore-unmatch
git clean -ffdx

if [[ "${DEPLOY_TARGET}" == "production" ]]; then
# Replace root site while preserving .nojekyll, CNAME, versioned Sphinx
# /docs/* trees, and any active /staging/ preview (cleared on demand via
# workflow_dispatch target=clear-staging).
git rm -r -f --ignore-unmatch *
git checkout HEAD -- .nojekyll CNAME docs/
if git cat-file -e HEAD:staging 2>/dev/null; then
git checkout HEAD -- staging/
fi
cp -a "${RUNNER_TEMP}/site-build/." .
git add -A
elif [[ "${DEPLOY_TARGET}" == "staging" ]]; then
git rm -r -f --ignore-unmatch staging
mkdir -p staging
cp -a "${RUNNER_TEMP}/site-build/." staging/
git add -A staging
elif [[ "${DEPLOY_TARGET}" == "clear-staging" ]]; then
git rm -r -f --ignore-unmatch staging
else
echo "Unknown deploy_target: ${DEPLOY_TARGET}" >&2
exit 1
fi

git config --global user.name github-actions
git config --global user.email github-actions@github.com
git commit -a -m "[docs] @${{ github.triggering_actor }}: Generate Website" \
-m "Commit: ${{ github.sha }}"
git push
if ! git diff --quiet || ! git diff --cached --quiet; then
git commit -a -m "[docs] @${TRIGGER_ACTOR}: Generate Website (${DEPLOY_TARGET})" \
-m "Source: ${GITHUB_REF_NAME} (${GITHUB_SHA})" \
-m "Target: ${DEPLOY_TARGET}"
git push
fi
env:
DEPLOY_TARGET: ${{ env.deploy_target }}
TRIGGER_ACTOR: ${{ github.triggering_actor }}
21 changes: 18 additions & 3 deletions RELEASE-PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Optional: version referenced below as `X.Y[.Z]` - replace with the real version
- [ ] Docstring examples all run correctly, nothing references removed or deprecated symbols.
- [ ] Changelog has release notes for major/minor release, all features, breaking changes, bug fixes, and known issues are documented.
- [ ] `website/pages/download.md` updated with the new version / installer link / release date.
- [ ] `website/pages/changelog.md`: move the release changes from the **Development** section at the bottom to the top.
- [ ] `website/pages/index.md`: Latest release version and date updated.
- [ ] `website/pages/changelog.md`: move the release changes from the **Development** section at the bottom to the top (`website/build.py` derives the homepage release date from this heading).
- [ ] Verify homepage version and date (`docs/LATEST_VERSION` + `website/pages/changelog.md` parsed by `website/build.py`) match `website/pages/download.md`.

## 3. Tests

Expand Down Expand Up @@ -55,8 +55,9 @@ Optional: version referenced below as `X.Y[.Z]` - replace with the real version

- [ ] Dispatch `release.yml` (Release Orchestrator) with the release tag while the Github release is still a **draft**. It runs the verify-then-publish ladder (MSI install/upgrade test -> TestPyPI -> publish Github release -> PyPI -> Docker), verifying each stage before the next; `verify-only` stops before anything goes public. See the header of `release.yml` for details.
- [ ] Verify both projects: https://pypi.org/project/scenedetect/ and https://pypi.org/project/scenedetect-headless/.
- [ ] Deploy website: `generate-website.yml`
- [ ] Deploy website: dispatch `generate-website.yml` with `target=production` (or push to `main`).
- [ ] Deploy docs: `generate-docs.yml`
- [ ] Fast-forward the `latest` branch to the tagged release commit (`git push origin vX.Y[.Z]:refs/heads/latest`) so stable GitHub links (`/blob/latest/scenedetect.cfg`) track the new release.
- [ ] Merge release branch back into `main`, verify `docs/LATEST_VERSION` is correct
- [ ] [Manually dispatch `generate-docs.yml`](https://github.com/Breakthrough/PySceneDetect/actions/workflows/generate-docs.yml) against `releases/X.Y` to update www.scenedetect.com/docs/latest
- [ ] Smoke-test PyPI release: in a fresh venv, `pip install scenedetect==X.Y.Z`; CLI launches and `scenedetect --version` looks correct.
Expand All @@ -71,3 +72,17 @@ Optional: version referenced below as `X.Y[.Z]` - replace with the real version
- **Branching model**: work spans multiple commits on `releases/X.Y[.Z]`; the final one gets the `vX.Y[.Z]` tag which gates the release-test workflow. A passing release-test is a hard prerequisite for publishing.
- **Version consistency** is enforced in two places (`__init__.py`, `PySceneDetect.aip`). The `static` job of `release-test.yml` checks `__init__.py` against the tag and verifies the changelog has a matching `## PySceneDetect X.Y` heading; the installer parity is checked by `scripts/pre_release.py --release`.
- **Changelog convention**: the in-development section lives at the *bottom* of `website/pages/changelog.md` under the "Development" heading - don't move it to the top.

### Special Branch Naming Scheme

| Pattern | Purpose | Automated CI / Triggers |
| --- | --- | --- |
| `main` | Active development / integration branch | Full test suite, `docs/head`, production website, Docker `main` |
| `latest` | Fast-forwarding pointer to the latest stable release commit | Stable GitHub file URLs (`/blob/latest/scenedetect.cfg`); does not trigger release/`v*` workflows or AppVeyor |
| `releases/<X.Y[.Z]>` | Release stabilization & maintenance branches (e.g. `releases/0.7.3`) | Full test suite, `docs/<X.Y[.Z]>` + `docs/latest`, AppVeyor (on `v*` tags) |
| `website/<name>` | Website redesign / content branches (e.g. `website/redesign`) | Auto-deploys staging preview to `scenedetect.com/staging/` via `generate-website.yml` (`'website/**'`) |
| `feature/<name>` | New features / detectors (e.g. `feature/color-detector`) | PR checks only |
| `issue/<num>-<desc>` | Issue-linked fixes / work (e.g. `issue/512-description`) | PR checks only |
| `fix/<name>` | Standalone bug fixes without a linked issue number | PR checks only |
| `docs/<name>` | Reference documentation / style updates (non-staging) | PR checks only |
| `gh-pages`, `resources` | Infrastructure branches (published site/docs; test video fixtures) | Automated deploy target / test fixture store |
Loading
Loading