Skip to content

Commit

Permalink
[Actions] Publish website using release branch
Browse files Browse the repository at this point in the history
For a variety of reasons we cannot have the github actions bot commit changes directly to the `main`
branch, but we still want the process of creating new docusaurus versions to be automated in our
release process.

The approach here is to have a release branch called `docusaurus-versions` which will contain all
of the docusaurus data for versioning. The behavior is:
    1. We always build the website from the docusaurus-versions branch
    2. Before building the website we always sync docusaurus-versions with main
    3. For new releases our github workflow will create the new docusaurus version in the docusaurus-versions branch

The main branch would then only be responsible for tracking the latest documentation, and our
github workflows can continue to automate the release process from the docusaurus-versions branch without touching main.
  • Loading branch information
CristianLara committed Dec 18, 2024
1 parent 48f3757 commit 47a42f2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/publish_website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: 'docusaurus-versions' # release branch
fetch-depth: 0
- name: Sync release branch with main
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git merge origin/main
# To avoid a large number of commits we don't push this sync commit to github until a new release.
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand All @@ -39,17 +48,14 @@ jobs:
- 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
git push --force origin HEAD:docusaurus-versions
- name: Build website
run: |
bash scripts/build_docs.sh -b
Expand Down

0 comments on commit 47a42f2

Please sign in to comment.