FEAT: Further docs and CLI improvements, tests notebooks #103
Workflow file for this run
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
name: sync-to-readthedocs-repo | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: | |
- main | |
- latest | |
- 'pre/*' | |
- dario/quick_patches_pre/2.6 | |
workflow_dispatch: | |
inputs: | |
env: | |
description: environment | |
default: dev | |
required: true | |
jobs: | |
set_env: | |
outputs: | |
env: ${{ steps.setenv.outputs.env }} | |
dest-branch: ${{ steps.dest-branch.outputs.branch }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Extract branch name | |
id: extract_branch | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
- id: setenv | |
run: | | |
if test -n "${{ github.event.inputs.env }}" | |
then | |
echo "::set-output name=env::${{ github.event.inputs.env }}" | |
echo "ENV=${{ github.event.inputs.env }}" >> $GITHUB_ENV | |
elif test "${{ github.event_name }}" = 'push' -a "${{ github.ref }}" = 'refs/heads/latest' | |
then | |
echo "::set-output name=env::dev" | |
echo "ENV=dev" >> $GITHUB_ENV | |
elif test "${{ github.event_name }}" = 'push' -a "${{ github.ref }}" = 'refs/heads/main' | |
then | |
echo "::set-output name=env::prod" | |
echo "ENV=prod" >> $GITHUB_ENV | |
else | |
echo "::set-output name=env::dev" | |
echo "ENV=dev" >> $GITHUB_ENV | |
fi | |
- id: dest-branch | |
run: | | |
case ${{ env.ENV }} in | |
dev) | |
echo "::set-output name=branch::{{ steps.extract_branch.outputs.branch }}" | |
;; | |
prod) | |
echo "::set-output name=branch::main" | |
;; | |
esac | |
build-and-deploy: | |
needs: set_env | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: . | |
token: ${{ secrets.GH_PAT }} | |
repository-name: flexcompute-readthedocs/tidy3d-docs | |
target-folder: . | |
branch: ${{ needs.set_env.outputs.dest-branch }} |