Skip to content

Commit

Permalink
Ok lets try this
Browse files Browse the repository at this point in the history
  • Loading branch information
daquinteroflex committed Jan 22, 2025
1 parent 8c62637 commit fe7bb70
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 11 deletions.
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-notebook-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-notebook-docs.git
git push mirror ${{ needs.extract_branch_or_tag.outputs.ref_name }} --force # overwrites always
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
16 changes: 5 additions & 11 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
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
extra_requirements:
- dev

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"

0 comments on commit fe7bb70

Please sign in to comment.