Test on test_sphinx_docs #12
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: Deploy Website and Docs | |
on: | |
push: | |
branches: | |
- master | |
- test_sphinx_docs # TODO (azeey) Remove after testing is done | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
WEBSITE_PATH: "website" | |
DOCS_PATH: "docs" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
# Build website from gazebosim-web-frontend | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: gazebo-web/gazebosim-web-frontend | |
ref: support_github_pages | |
path: ${{ env.WEBSITE_PATH }} | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: npm | |
cache-dependency-path: ${{ env.WEBSITE_PATH }}/package-lock.json | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v5 | |
- name: Install Website dependencies | |
run: npm ci | |
working-directory: ${{ env.WEBSITE_PATH }} | |
- name: Build Website | |
run: npm run build -- --base-href "${{ steps.pages.outputs.base_url }}/" | |
working-directory: ${{ env.WEBSITE_PATH }} | |
# Build Docs | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.DOCS_PATH }} | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- name: Install Docs dependencies | |
run: pip install -r requirements.txt | |
working-directory: ${{ env.DOCS_PATH }} | |
- name: Build Docs | |
run: python build_multiversion.py --pointers --libs --output_dir ${{ github.workspace }}/${{ env.WEBSITE_PATH }}/dist | |
env: | |
GZ_DEPLOY_URL: "${{ steps.pages.outputs.base_url }}" | |
working-directory: ${{ env.DOCS_PATH }} | |
# Upload the artifact for local preview | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ${{ env.WEBSITE_PATH }}/dist | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/test_sphinx_docs' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ${{ env.WEBSITE_PATH }}/dist | |
keep_files: true |