name: "Deploy Docs" on: push: branches: ["master", "release/stable"] pull_request: branches: ["master", "release/*"] paths: - ".github/workflows/docs-deploy.yml" # TODO: this workflow is just for debugging. extend the paths that should trigger it defaults: run: shell: bash jobs: # https://github.com/marketplace/actions/deploy-to-github-pages build-docs-deploy: if: github.repository_owner == 'Lightning-AI' runs-on: ubuntu-latest container: image: pytorchlightning/pytorch_lightning:docs steps: - name: Checkout 🛎️ uses: actions/checkout@v3 # If you're using actions/checkout@v3 you must set persist-credentials to false in most cases for the deployment to work correctly. with: persist-credentials: false - uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_ID }} aws-region: us-east-1 - run: aws s3 sync s3://sphinx-packages/ pypi/ # Note: This uses an internal pip API and may not always work # https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow - name: Cache pip uses: actions/cache@v3 with: path: ~/.cache/pip key: deploy-docs-pip-${{ hashFiles('requirements/**/*.txt') }} restore-keys: deploy-docs-pip- - name: Install package & dependencies env: FREEZE_REQUIREMENTS: 1 TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html" run: | pip --version pip install -e . -r requirements/app/docs.txt \ -f ${TORCH_URL} -f pypi pip list - name: Make Documentation working-directory: ./docs/source-app run: | # First run the same pipeline as Read-The-Docs make clean make html --jobs 2 - name: Deploy 🚀 uses: JamesIves/github-pages-deploy-action@v4.4.1 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 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 if: github.event_name == 'push' && github.ref == 'refs/heads/master' - name: Authenticate to Google Cloud if: github.event_name == 'push' uses: google-github-actions/auth@v1 with: credentials_json: ${{ secrets.GCS_SA_KEY }} - name: Setup gcloud if: github.event_name == 'push' uses: google-github-actions/setup-gcloud@v1 with: project_id: ${{ secrets.GCS_PROJECT }} # Uploading docs to GCS, so they can be served on lightning.ai - name: Upload docs/stable to GCS 🪣 if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/') run: gsutil -m rsync -d -R docs/build/html/ gs://lightning-docs-stable # Uploading docs to GCS, so they can be served on lightning.ai - name: Upload docs/latest to GCS 🪣 if: github.event_name == 'push' && github.ref == 'refs/heads/master' run: gsutil -m rsync -d -R docs/build/html/ gs://lightning-docs-latest