Skip to content

Commit

Permalink
Merge pull request #23 from CristianLara/gh-actions-unify-website-pub…
Browse files Browse the repository at this point in the history
…lish-version

[Actions] publish_website.yml also handles versioning logic
  • Loading branch information
CristianLara authored Nov 26, 2024
2 parents 88182f4 + 88f9d1b commit eab3883
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 42 deletions.
39 changes: 4 additions & 35 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 25 additions & 7 deletions .github/workflows/publish_website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,50 @@ 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 ]


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:
python-version: "3.10"
- 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
Expand Down

0 comments on commit eab3883

Please sign in to comment.