Skip to content

Merge tidy3d and docs no history #7

Merge tidy3d and docs no history

Merge tidy3d and docs no history #7

name: sync-to-readthedocs-repo
permissions:
contents: write
on:
push:
branches:
- main
- latest
- repo_merge_no_history
pull_request:
branches:
- develop
- 'pre/*'
- poetry_upgrade
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:
- 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::develop"
;;
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
- name: Pushes to another repository
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.RTD_PAT }}
with:
source-directory: './'
destination-github-username: 'flexcompute-readthedocs'
destination-repository-name: 'tidy3d-docs-demo'
target-branch: ${{ needs.set_env.outputs.dest-branch }}