vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
11.33k stars 1.83k forks source link

Github action deploy failed, instructed by the guildance #3792

Closed TheoppoFish closed 2 days ago

TheoppoFish commented 1 week ago

Describe the bug

Hi team,

I have tried with a self-hosted gha runner.

the gha workflow is copy/paste from the guidance, here

Unfortunately, I failed at the Upload artifact stage image

Here is my workflow:

name: Deploy VitePress site to git pages

on:
  push:
    branches: [main]

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: pages
  cancel-in-progress: false

jobs:
  build:
    runs-on: self-hosted
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: 18
          cache: npm
      - name: Setup Pages
        uses: actions/configure-pages@v4
      - name: Install dependencies
        run: npm install
      - name: Build with VitePress
        env:
          NODE_OPTIONS: "--max_old_space_size=4096"
        run: npm run docs:build
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: .vitepress/dist

  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    needs: build
    runs-on: self-hosted
    name: Deploy
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4

Reproduction

Re-runed multiple times, but still failed

Expected behavior

should upload artefacts?

System Info

deploying on git page

using self-host runner

Additional context

No response

Validations

brc-dd commented 2 days ago

I have no idea. Please check with GitHub support on how to upload artifacts with third party / self hosted runners. You can create a separate branch and use branch-based github pages deployment instead of using actions to upload pages artifacts.

You can probably use something like this https://github.com/peaceiris/actions-gh-pages for branch based deploys. (the publish_dir should be configured to docs/.vitepress/dist. You can remove upload artifact step.