Skip to content
Closed
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
72 changes: 72 additions & 0 deletions .github/workflows/sync-to-readthedocs-repo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: "sync-to-readthedocs-repo"

on:
workflow_dispatch:
push:
branches:
- main
- latest
- develop
- 'pre/*'
- 'demo/test/*'
tags:
- 'v*'
- 'demo/*'

jobs:
extract_branch_or_tag:
outputs:
ref_name: ${{ steps.extract.outputs.ref_name }}
runs-on: ubuntu-latest
steps:
- id: extract
name: Extract branch or tag name
shell: bash
run: |
REF_NAME="${GITHUB_REF#refs/*/}"
echo "::set-output name=ref_name::$REF_NAME"
echo "Extracted ref: $REF_NAME"

build-and-deploy:
permissions:
contents: write
needs: extract_branch_or_tag
runs-on: ubuntu-latest
steps:
# Conditional Checkout for Branch
- name: Checkout Branch if branch-triggered-sync
if: contains(github.ref, 'refs/heads/')
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.GH_PAT }}
ref: ${{ needs.extract_branch_or_tag.outputs.ref_name }}

- name: Push corresponding reference to mirror repo if a branch
if: contains(github.ref, 'refs/heads/')
run: |
git fetch --unshallow origin ${{ needs.extract_branch_or_tag.outputs.ref_name }}
git pull origin ${{ needs.extract_branch_or_tag.outputs.ref_name }}
git remote add mirror https://github.com/flexcompute-readthedocs/tidy3d-notebooks-docs.git
git push mirror ${{ needs.extract_branch_or_tag.outputs.ref_name }} --force # overwrites always
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

# Conditional Checkout for Tag
- name: Checkout Tag if tag-triggered-sync
if: contains(github.ref, 'refs/tags/')
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.GH_PAT }}
fetch-depth: 0
ref: ${{ needs.extract_branch_or_tag.outputs.ref_name }}
fetch-tags: true

- name: Push corresponding reference to mirror repo if a tag
if: contains(github.ref, 'refs/tags/')
run: |
git remote add mirror https://github.com/flexcompute-readthedocs/tidy3d-notebooks-docs.git
git push mirror ${{ needs.extract_branch_or_tag.outputs.ref_name }} --force # overwrites always
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
17 changes: 4 additions & 13 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
version: 2

submodules:
include:
- tidy3d
recursive: true

build:
os: "ubuntu-20.04"
os: "ubuntu-22.04"
tools:
python: "3.10"
python: "3.11"
sphinx:
fail_on_warning: false
configuration: docs/source/conf.py
configuration: docs/conf.py

python:
# Install our python package before building the docs
install:
- method: pip
path: .
- requirements: docs/requirements.txt
- requirements: tidy3d/requirements.txt
- requirements: requirements.txt

formats: []

Expand Down
4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from ...conf import *

extensions = extensions
project = "Tidy3D Examples"
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tidy3d[dev]
Loading