Merge pull request #20 from flexcompute/alec/converter_update #63
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-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: develop | |
required: true | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
env: | |
SOURCE_BRANCH: ${{ inputs.sourceBranch || 'develop' }} | |
TARGET_BRANCH: ${{ inputs.targetBranch || 'develop' }} | |
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 flexcompute.com | |
uses: actions/checkout@v4 | |
with: | |
repository: cmsflexc/flexcompute.com | |
token: ${{ secrets.GH_PAT }} | |
path: flexcompute.com | |
ref: ${{ env.TARGET_BRANCH }} | |
- run: | | |
cd ${{ github.workspace }} | |
[ ! -d "${{ github.workspace }}/flexcompute.com/assets/tidy3d/faqs" ] && mkdir -p ${{ github.workspace }}/flexcompute.com/assets/tidy3d/faqs | |
[ ! -d "${{ github.workspace }}/flexcompute.com/_data/tidy3d_faqs" ] && mkdir -p ${{ github.workspace }}/flexcompute.com/_data/tidy3d_faqs | |
rsync -r ${{ github.workspace }}/tidy3d-faq/temp/ ${{ github.workspace }}/flexcompute.com/_faqs | |
rsync -r ${{ github.workspace }}/tidy3d-faq/_faqs/img/ ${{ github.workspace }}/flexcompute.com/assets/tidy3d/faqs | |
rsync ${{ github.workspace }}/tidy3d-faq/faq_categories.yml ${{ github.workspace }}/flexcompute.com/_data/tidy3d_faqs/faq_categories.yml | |
- run: | | |
ls -la ${{ github.workspace }}/flexcompute.com/_faqs | |
ls -la ${{ github.workspace }}/flexcompute.com/assets/tidy3d/faqs | |
ls -la ${{ github.workspace }}/flexcompute.com/_data/tidy3d_faqs | |
- name: Commit change to target repo | |
shell: bash | |
working-directory: ${{ github.workspace }}/flexcompute.com | |
env: | |
GH_TOKEN: ${{ secrets.GH_PAT }} | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "github_auto" | |
git add . | |
git diff-index --quiet HEAD || git commit -m "sync(): sync from tidy3d-faq" | |
git push |