Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 46 additions & 19 deletions .github/workflows/docs-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Docs

on:
workflow_dispatch:
push:
branches:
- main
Comment thread
guysmoilov marked this conversation as resolved.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a good idea to push to docs on pushes to main.
You don't want the users to do a pip install and then go look at the docs and get a version that's more new, because there was no release yet.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pushes to main only deploy to test.dagshub.com

release:
types: [ published ]
pull_request:
Expand Down Expand Up @@ -39,40 +42,64 @@ jobs:
run: SPHINXOPTS="-W" make html

- name: Upload build artifact
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: docs-html
path: docs/build/html

deploy:
name: Deploy documentation
deploy-test:
name: Deploy to test.dagshub.com
needs: build
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: docs-html
path: docs-html

- name: Authenticate with Google
uses: "google-github-actions/auth@v2"
with:
project_id: ${{ secrets.GCS_PROJECT }}
credentials_json: ${{ secrets.GCS_SERVICE_ACCOUNT_ACCESS_KEY }}
path: build/html

- name: Set up Cloud SDK
uses: "google-github-actions/setup-gcloud@v2"
- name: Assemble deploy package
run: |
mkdir -p dist/docs/client
cp -r build/html/. dist/docs/client/
cp docs/deploy/root-index.html dist/index.html
cp docs/deploy/staticwebapp.config.json dist/staticwebapp.config.json
cp docs/deploy/404.html dist/404.html

- name: Upload to Google Cloud Storage
- name: Deploy to test SWA
env:
UPLOAD_PATH: ${{ format('gs://{0}/docs/client', secrets.DOCS_BUCKET) }}
run: gsutil -m rsync -d -r docs-html $UPLOAD_PATH
SWA_DEPLOY_TOKEN: ${{ secrets.SWA_DEPLOY_TOKEN_TEST }}
run: npx --yes @azure/static-web-apps-cli deploy ./dist --deployment-token "$SWA_DEPLOY_TOKEN" --env production

deploy-prod:
name: Deploy to dagshub.com
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: docs-html
path: build/html

- name: Assemble deploy package
run: |
mkdir -p dist/docs/client
cp -r build/html/. dist/docs/client/
cp docs/deploy/root-index.html dist/index.html
cp docs/deploy/staticwebapp.config.json dist/staticwebapp.config.json
cp docs/deploy/404.html dist/404.html

- name: Invalidate CDN Cache
- name: Deploy to prod SWA
env:
LOAD_BALANCER: ${{ secrets.LOAD_BALANCER_NAME }}
run: gcloud compute url-maps invalidate-cdn-cache $LOAD_BALANCER --async --path "/docs/client/*"
SWA_DEPLOY_TOKEN: ${{ secrets.SWA_DEPLOY_TOKEN_PROD }}
run: npx --yes @azure/static-web-apps-cli deploy ./dist --deployment-token "$SWA_DEPLOY_TOKEN" --env production
Loading
Loading