diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index c1ff38d..55d3de9 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,59 +1,70 @@ name: Documentation on: - # trigger deployment on push to master branch when changes to docs/** + # Runs on pushes targeting the `main` branch. Change this to `master` if you're + # using the `master` branch as the default branch. push: paths: - "docs/**" branches: - main - # trigger deployment manually + + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: pages + cancel-in-progress: false + jobs: - deploy: + # Build job + build: runs-on: ubuntu-latest defaults: run: working-directory: docs/ - steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 with: - # fetch all commits to get last updated time or other git log info - fetch-depth: 0 + fetch-depth: 0 # Not needed if lastUpdated is not enabled - - name: Setup Node.js + - name: Setup Node uses: actions/setup-node@v4 with: - node-version: "20" - - - name: Cache dependencies - uses: actions/cache@v4 - id: npm-cache - with: - path: | - **/node_modules - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- + node-version: 20 + cache: npm + - name: Setup Pages + uses: actions/configure-pages@v4 - name: Install dependencies - if: steps.npm-cache.outputs.cache-hit != 'true' - run: npm install + run: npm ci - - name: Build VitePress site + - name: Build with VitePress run: npm run build - # - name: Bundle CNAME with site dist - # run: cp CNAME .vitepress/dist + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs/.vitepress/dist + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: build + runs-on: ubuntu-latest + name: Deploy + steps: - name: Deploy to GitHub Pages - uses: crazy-max/ghaction-github-pages@v4 - with: - # deploy to gh-pages branch - target_branch: gh-pages - # deploy the default output dir of VitePress - build_dir: docs/.vitepress/dist - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file