Skip to content

Commit fe7bb70

Browse files
Ok lets try this
1 parent 8c62637 commit fe7bb70

File tree

3 files changed

+81
-11
lines changed

3 files changed

+81
-11
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: "sync-to-readthedocs-repo"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- latest
9+
- develop
10+
- 'pre/*'
11+
- 'demo/test/*'
12+
tags:
13+
- 'v*'
14+
- 'demo/*'
15+
16+
jobs:
17+
extract_branch_or_tag:
18+
outputs:
19+
ref_name: ${{ steps.extract.outputs.ref_name }}
20+
runs-on: ubuntu-latest
21+
steps:
22+
- id: extract
23+
name: Extract branch or tag name
24+
shell: bash
25+
run: |
26+
REF_NAME="${GITHUB_REF#refs/*/}"
27+
echo "::set-output name=ref_name::$REF_NAME"
28+
echo "Extracted ref: $REF_NAME"
29+
30+
build-and-deploy:
31+
permissions:
32+
contents: write
33+
needs: extract_branch_or_tag
34+
runs-on: ubuntu-latest
35+
steps:
36+
# Conditional Checkout for Branch
37+
- name: Checkout Branch if branch-triggered-sync
38+
if: contains(github.ref, 'refs/heads/')
39+
uses: actions/checkout@v3
40+
with:
41+
submodules: true
42+
token: ${{ secrets.GH_PAT }}
43+
ref: ${{ needs.extract_branch_or_tag.outputs.ref_name }}
44+
45+
- name: Push corresponding reference to mirror repo if a branch
46+
if: contains(github.ref, 'refs/heads/')
47+
run: |
48+
git fetch --unshallow origin ${{ needs.extract_branch_or_tag.outputs.ref_name }}
49+
git pull origin ${{ needs.extract_branch_or_tag.outputs.ref_name }}
50+
git remote add mirror https://github.com/flexcompute-readthedocs/tidy3d-notebook-docs.git
51+
git push mirror ${{ needs.extract_branch_or_tag.outputs.ref_name }} --force # overwrites always
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
54+
55+
# Conditional Checkout for Tag
56+
- name: Checkout Tag if tag-triggered-sync
57+
if: contains(github.ref, 'refs/tags/')
58+
uses: actions/checkout@v3
59+
with:
60+
submodules: true
61+
token: ${{ secrets.GH_PAT }}
62+
fetch-depth: 0
63+
ref: ${{ needs.extract_branch_or_tag.outputs.ref_name }}
64+
fetch-tags: true
65+
66+
- name: Push corresponding reference to mirror repo if a tag
67+
if: contains(github.ref, 'refs/tags/')
68+
run: |
69+
git remote add mirror https://github.com/flexcompute-readthedocs/tidy3d-notebook-docs.git
70+
git push mirror ${{ needs.extract_branch_or_tag.outputs.ref_name }} --force # overwrites always
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

.readthedocs.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
version: 2
2-
3-
submodules:
4-
include:
5-
- tidy3d
6-
recursive: true
7-
82
build:
9-
os: "ubuntu-20.04"
3+
os: "ubuntu-22.04"
104
tools:
11-
python: "3.10"
5+
python: "3.11"
126
sphinx:
137
fail_on_warning: false
14-
configuration: docs/source/conf.py
8+
configuration: docs/conf.py
159

1610
python:
1711
# Install our python package before building the docs
1812
install:
1913
- method: pip
2014
path: .
21-
- requirements: docs/requirements.txt
22-
- requirements: tidy3d/requirements.txt
15+
extra_requirements:
16+
- dev
2317

2418
formats: []
2519

docs/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from ...conf import *
2+
3+
extensions = extensions
4+
project = "Tidy3D Examples"

0 commit comments

Comments
 (0)