-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c62637
commit fe7bb70
Showing
3 changed files
with
81 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from ...conf import * | ||
|
||
extensions = extensions | ||
project = "Tidy3D Examples" |