diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9b7f493baa6..b27ea1b0edc 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -23,43 +23,12 @@ jobs: # pinned_botorch: true # secrets: inherit - create-docusaurus-version: - # needs: tests-and-coverage-pinned # only run if test step succeeds - runs-on: ubuntu-latest - outputs: - new-commit-sha: ${{ steps.create-version.outputs.NEW_COMMIT_SHA }} - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - name: Run Tutorials - run: | - pip install -e ".[tutorial]" - python scripts/run_tutorials.py -w $(pwd) - - name: Convert Tutorials - run: | - python3 scripts/convert_ipynb_to_mdx.py --clean - - name: Create new version in Docusaurus - id: create-version - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - cd website - yarn - yarn docusaurus docs:version ${{ github.event.release.tag_name }} - git add --all - git commit -m "Create version ${{ github.event.release.tag_name }} of site in Docusaurus" - git push --force origin HEAD:main - echo "NEW_COMMIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - - publish-website: - needs: create-docusaurus-version - name: Publish website + version-and-publish-website: + # needs: tests-and-coverage-pinned + name: Version and Publish website uses: ./.github/workflows/publish_website.yml with: - ref: ${{ needs.create-docusaurus-version.outputs.new-commit-sha }} + new_version: ${{ github.event.release.tag_name }} secrets: inherit # TODO: Temporarily disabled while making changes on fork. Re-enable before merging back into facebook/Ax diff --git a/.github/workflows/publish_website.yml b/.github/workflows/publish_website.yml index b615f7e04ff..8d8e14ddb56 100644 --- a/.github/workflows/publish_website.yml +++ b/.github/workflows/publish_website.yml @@ -3,9 +3,13 @@ name: Publish Website on: workflow_call: inputs: - ref: + new_version: required: false type: string + run_tutorials: + required: false + type: boolean + default: false workflow_dispatch: push: branches: [ main ] @@ -13,12 +17,10 @@ on: jobs: - publish-stable-website: + publish-website: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: ${{ inputs.ref || github.ref }} - name: Set up Python uses: actions/setup-python@v5 with: @@ -26,9 +28,25 @@ jobs: - name: Install dependencies run: | pip install -e ".[tutorial]" - - name: Publish latest website - env: - GH_TOKEN: ${{ github.token }} + - if: ${{ inputs.run_tutorials }} + name: Run Tutorials + run: | + python scripts/run_tutorials.py -w $(pwd) + - if: ${{ inputs.new_version }} + name: Create new docusaurus version + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + + python3 scripts/convert_ipynb_to_mdx.py --clean + cd website + yarn + yarn docusaurus docs:version ${{ inputs.new_version }} + + git add --all + git commit -m "Create version ${{ inputs.new_version }} of site in Docusaurus" + git push --force origin HEAD:main + - name: Build website run: | bash scripts/make_docs.sh -b - name: Deploy