From c2640e1438c8746b925f0bb4ea40ea0a8c241bf3 Mon Sep 17 00:00:00 2001 From: Amirreza Date: Thu, 14 Nov 2024 09:09:28 +0330 Subject: [PATCH] docs: -update workflow file --- .github/workflows/deploy.yml | 59 +++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ec6f083..cf378ff 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,55 +1,60 @@ -name: Deploy Docusaurus to GitHub Pages +name: Deploy to GitHub Pages on: push: - branches: [ main , docs/* ] - pull_request: - branches: [ main , docs/* ] - workflow_dispatch: - -permissions: - contents: read - pages: write - id-token: write + branches: + - main + - docs/* jobs: build: + name: Build Docusaurus runs-on: ubuntu-latest - defaults: - run: - working-directory: ./documents steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup Bun uses: oven-sh/setup-bun@v1 with: bun-version: latest - - name: Setup Pages - uses: actions/configure-pages@v4 + - name: Get bun store path + id: bun-store-path + run: echo "STORE_PATH=$(bun pm cache dir)" >> $GITHUB_OUTPUT + + - name: Cache bun dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.bun-store-path.outputs.STORE_PATH }} + key: ${{ runner.os }}-bun-store-${{ hashFiles('**/bun.lockb') }} + restore-keys: | + ${{ runner.os }}-bun-store- - name: Install dependencies - run: bun install + run: bun install --frozen-lockfile - name: Build website - run: | - bun run build - ls -la # Debug: List all files - ls -la build || ls -la ./dist # Debug: Check both possible build directories + run: bun run build - - name: Upload artifact - id: deployment - uses: actions/deploy-pages@v4 + - name: Upload Build Artifact + uses: actions/upload-pages-artifact@v3 + with: + path: build deploy: + name: Deploy to GitHub Pages + needs: build + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} - needs: build + runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' steps: - name: Deploy to GitHub Pages id: deployment