diff --git a/.github/workflows/preview-docs.yml b/.github/workflows/preview-docs.yml index 3c74a0932..f52e7644d 100644 --- a/.github/workflows/preview-docs.yml +++ b/.github/workflows/preview-docs.yml @@ -18,48 +18,57 @@ name: Preview Documentation on: - pull_request: - paths: - - 'website/**' + workflow_run: + workflows: ["Build Documentation"] + types: + - completed jobs: - deploy-preview: + preview: runs-on: ubuntu-latest + permissions: + pull-requests: write + if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 + - name: Download artifact + uses: actions/github-script@v7 with: - version: 8 - run_install: false + script: | + const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{ github.event.workflow_run.id }}, + }); + const websiteArtifact = artifacts.data.artifacts.filter((artifact) => { + return artifact.name == 'website' + })[0]; + var download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: websiteArtifact.id, + archive_format: 'zip', + }); + const fs = require('fs'); + fs.writeFileSync('${{github.workspace}}/website.zip', Buffer.from(download.data)); - - uses: actions/setup-node@v4 - with: - node-version: "20" - - - name: Corepack - working-directory: website - run: npm i -g --force corepack && corepack enable - - - name: Install Dependencies - working-directory: website - run: pnpm install - - - name: Build - working-directory: website - run: pnpm build + - name: Unzip artifact + run: unzip -q website.zip -d website/build - - name: Deploy to Netlify + - name: Deploy preview to Netlify uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 with: publish-dir: './website/build' production-deploy: false github-token: ${{ secrets.GITHUB_TOKEN }} - deploy-message: ${{ github.event.pull_request.title }} + deploy-message: "Deploy preview for PR #${{ github.event.workflow_run.pull_requests[0].number }}" enable-pull-request-comment: true enable-commit-comment: false enable-github-deployment: false - alias: deploy-preview-${{ github.event.number }} + alias: deploy-preview-${{ github.event.workflow_run.pull_requests[0].number }} env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + timeout-minutes: 10 \ No newline at end of file diff --git a/website/docs/quickstart/example.md b/website/docs/quickstart/example.md index 171ef7640..bc554e5ab 100644 --- a/website/docs/quickstart/example.md +++ b/website/docs/quickstart/example.md @@ -7,6 +7,8 @@ title: 'Simple example' ### Read the spreadsheet +Just change for preview! Trigger the Build. + Below is an example of reading a spreadsheet document: ```java