-
Notifications
You must be signed in to change notification settings - Fork 30
Deploy client docs to Azure SWA instead of GCS #692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,9 @@ name: Docs | |
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: | ||
|
|
@@ -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 | ||
Uh oh!
There was an error while loading. Please reload this page.