sync-to-marketing-site #89
This file contains hidden or 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-marketing-site | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| paths: | |
| - '_faqs/**' | |
| - 'faq_categories.json' | |
| workflow_dispatch: | |
| inputs: | |
| sourceBranch: | |
| description: source branch | |
| default: develop | |
| required: true | |
| targetBranch: | |
| description: target branch | |
| default: flexcompute/main | |
| required: true | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| env: | |
| SOURCE_BRANCH: ${{ inputs.sourceBranch || 'develop' }} | |
| TARGET_BRANCH: ${{ inputs.targetBranch || 'flexcompute/main' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ env.SOURCE_BRANCH }} | |
| path: tidy3d-faq | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - run: | | |
| cd ${{ github.workspace }}/tidy3d-faq | |
| pip install -r script/requirements.txt | |
| python script/convert-and-sync.py | |
| - name: Checkout flex | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: flexcompute/flex | |
| path: flex | |
| ref: ${{ env.TARGET_BRANCH }} | |
| - run: | | |
| cd ${{ github.workspace }} | |
| [ ! -d "${{ github.workspace }}/flex/frontend/flexcompute.com/assets/tidy3d/faqs" ] && mkdir -p ${{ github.workspace }}/flex/frontend/flexcompute.com/assets/tidy3d/faqs | |
| [ ! -d "${{ github.workspace }}/flex/frontend/flexcompute.com/_data/tidy3d_faqs" ] && mkdir -p ${{ github.workspace }}/flex/frontend/flexcompute.com/_data/tidy3d_faqs | |
| rsync -r ${{ github.workspace }}/tidy3d-faq/temp/ ${{ github.workspace }}/flex/frontend/flexcompute.com/_faqs | |
| rsync -r ${{ github.workspace }}/tidy3d-faq/_faqs/img/ ${{ github.workspace }}/flex/frontend/flexcompute.com/assets/tidy3d/faqs | |
| rsync ${{ github.workspace }}/tidy3d-faq/faq_categories.yml ${{ github.workspace }}/flex/frontend/flexcompute.com/_data/tidy3d_faqs/faq_categories.yml | |
| - run: | | |
| ls -la ${{ github.workspace }}/flex/frontend/flexcompute.com/_faqs | |
| ls -la ${{ github.workspace }}/flex/frontend/flexcompute.com/assets/tidy3d/faqs | |
| ls -la ${{ github.workspace }}/flex/frontend/flexcompute.com/_data/tidy3d_faqs | |
| - name: Commit change to target repo | |
| shell: bash | |
| working-directory: ${{ github.workspace }}/flex | |
| run: | | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "github_auto" | |
| git add frontend/flexcompute.com/ | |
| git diff-index --quiet HEAD || git commit -m "sync(): sync from tidy3d-faq" | |
| git push |