Skip to content

Commit

Permalink
ci: deploy docs via GCP (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda authored Mar 21, 2024
1 parent 164160f commit 0a1c6c4
Showing 1 changed file with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,46 @@ jobs:
install-tex: true

deploy-docs:
# https://github.com/marketplace/actions/deploy-to-github-pages
needs: build-docs
if: github.event_name != 'pull_request'
needs: docs-make
if: github.repository_owner == 'Lightning-AI' && github.event_name == 'push'
runs-on: ubuntu-latest
env:
GCP_TARGET: "gs://lightning-docs-thunder"
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
# If you're using actions/checkout@v4 you must set persist-credentials to false in most cases for the deployment to work correctly.
persist-credentials: false
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: docs-html-${{ github.sha }}
path: docs/build/

- name: Deploy 🚀
uses: JamesIves/[email protected]
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCS_SA_KEY }}

- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages # The branch the action should deploy to.
folder: docs/build/html # The folder the action should deploy.
clean: true # Automatically remove deleted files from the deploy branch
target-folder: docs # If you'd like to push the contents of the deployment folder into a specific directory
single-commit: true # you'd prefer to have a single commit on the deployment branch instead of full history
project_id: ${{ secrets.GCS_PROJECT }}

# Uploading docs to GCS, so they can be served on lightning.ai
#- name: Upload docs/thunder/stable to GCS 🪣
# if: startsWith(github.ref, 'refs/heads/release/')
# run: gsutil -m rsync -d -R docs/build/html/ ${GCP_TARGET}/stable

# Uploading docs to GCS, so they can be served on lightning.ai
- name: Upload docs/thunder/latest to GCS 🪣
if: github.ref == 'refs/heads/master'
run: gsutil -m rsync -d -R docs/build/html/ ${GCP_TARGET}/latest

# Uploading docs to GCS, so they can be served on lightning.ai
#- name: Upload docs/thunder/release to GCS 🪣
# if: startsWith(github.ref, 'refs/tags/')
# run: gsutil -m rsync -d -R docs/build/html/ ${GCP_TARGET}/${{ github.ref_name }}

# Uploading docs as archive to GCS, so they can be as backup
#- name: Upload docs as archive to GCS 🪣
# if: startsWith(github.ref, 'refs/tags/')
# working-directory: docs/build
# run: |
# zip ${{ github.ref_name }}.zip -r html/
# gsutil cp ${{ github.ref_name }}.zip ${GCP_TARGET}

0 comments on commit 0a1c6c4

Please sign in to comment.