这是indexloc提供的服务,不要输入任何密码
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
67 changes: 67 additions & 0 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Commit Pipeline

concurrency: docs-push

on:
push:
branches:
- 'main'

env:
POETRY_VIRTUALENVS_IN_PROJECT: "true"
# Force nox to produce colorful logs:
FORCE_COLOR: "true"

jobs:
Package:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up runner
uses: ./.github/actions/setup
- run: poetry run nox -s build
- name: Archive packaged library
uses: actions/upload-artifact@v4
with:
name: dist
path: dist

Push-Docs:
runs-on: ubuntu-latest
environment: docs-push
needs: Package
steps:
- name: Checkout code repository
uses: actions/checkout@v4
- name: Set up runner
uses: ./.github/actions/setup
- name: Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Get commit
id: commit
run: echo "COMMIT=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- run: poetry run nox -s docs
- run: rm -r public/.doctrees
- name: Checkout docs repository
uses: actions/checkout@v4
with:
repository: 'opendp/tumult-docs'
token: ${{ secrets.DOCS_REPO_PAT}}
path: tumult-docs
- run: rm -r tumult-docs/docs/analytics/dev
- run: mv public tumult-docs/docs/analytics/dev
- name: commit to docs repo
working-directory: tumult-docs
env:
COMMIT: ${{ steps.commit.outputs.COMMIT}}
run: |
git config user.name "docs-bot"
git config user.email "87283505+opendp-dev@users.noreply.github.com"
git add docs/analytics/dev
git commit -m "[auto] Publish docs for dev ($COMMIT)"
git push

16 changes: 9 additions & 7 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,23 @@

### Build information

ci_tag = os.getenv("CI_COMMIT_TAG")
ci_branch = os.getenv("CI_COMMIT_BRANCH")
pipeline_type = os.getenv("GITHUB_REF_TYPE")
ref_name = os.getenv("GITHUB_REF_NAME")

# For non-prerelease tags, make the version "vX.Y" to match how we show it in
# the version switcher and the docs URLs. Sphinx's nomenclature around versions
# can be a bit confusing -- "version" means sort of the documentation version
# (for us, the minor release), while "release" is the full version number of the
# package on which the docs were built.
if ci_tag and "-" not in ci_tag:
release = ci_tag
version = "v" + ".".join(ci_tag.split(".")[:2])
if pipeline_type and pipeline_type == "tag" and "-" not in ref_name:
release = ref_name
version = "v" + ".".join(ref_name.split(".")[:2])
else:
release = version = ci_tag or ci_branch or "HEAD"
release = version = ref_name or "HEAD"

commit_hash = os.getenv("CI_COMMIT_SHORT_SHA") or "unknown version"
commit_sha = os.getenv("GITHUB_SHA")

commit_hash = commit_sha[:8] if commit_sha else "unknown version"
build_time = datetime.datetime.utcnow().isoformat(sep=" ", timespec="minutes")

# Linkcheck will complain that these anchors don't exist,
Expand Down