Fix no sandbox issue (#1688) #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) Microsoft Corporation. | |
| # Licensed under the MIT License. | |
| name: Build and Deploy Docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - siteTestCode | |
| # Only run when docs-related files change | |
| paths: | |
| - 'docs/**' | |
| # Allow manual deployment from the Actions tab | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| pages: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: docs | |
| permissions: | |
| contents: write | |
| id-token: write | |
| pages: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Get User Permission | |
| id: checkAccess | |
| uses: actions-cool/check-user-permission@v2 | |
| with: | |
| require: write | |
| username: ${{ github.triggering_actor }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check User Permission | |
| if: steps.checkAccess.outputs.require-result == 'false' | |
| run: | | |
| echo "${{ github.triggering_actor }} does not have permissions on this repo." | |
| echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}" | |
| echo "Job originally triggered by ${{ github.actor }}" | |
| exit 1 | |
| - name: Checkout Repository 🛎️ | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| fetch-depth: 0 | |
| - name: Check Repository Structure | |
| run: | | |
| echo "Repository root contents:" | |
| ls -la | |
| working-directory: . | |
| - name: Setup Node.js ⚙️ | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18.x | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| run_install: false | |
| - name: Get pnpm store directory | |
| id: pnpm-cache | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install Dependencies 📦 | |
| run: pnpm install | |
| - name: Update Links in Markdown Files 🔄 | |
| run: | | |
| # Run the link update script | |
| node scripts/update-links.js | |
| - name: Build Site 🔧 | |
| run: pnpm run build | |
| env: | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| name: github-pages | |
| path: docs/_site | |
| - name: Deploy to GitHub Pages from artifacts | |
| uses: actions/deploy-pages@v4 |