Skip to content

Add GitHub Actions workflow for Vite app deployment to GitHub Pages#13

Open
Copilot wants to merge 2 commits into
mainfrom
copilot/setup-github-actions-workflow
Open

Add GitHub Actions workflow for Vite app deployment to GitHub Pages#13
Copilot wants to merge 2 commits into
mainfrom
copilot/setup-github-actions-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 2, 2025

GitHub Pages deployment was failing with No such file or directory @ dir_chdir0 - /github/workspace/docs because it defaulted to Jekyll build instead of building the Vite app.

Changes

  • Add .github/workflows/deploy.yml with proper Vite build pipeline
  • Build job: checkout → Node.js 20 (with npm cache) → npm cinpm run build → upload ./dist artifact
  • Deploy job: depends on build, deploys to github-pages environment via actions/deploy-pages@v4
  • Triggers on push to main with required permissions (contents: read, pages: write, id-token: write)
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - run: npm ci
      - run: npm run build
      - uses: actions/upload-pages-artifact@v3
        with:
          path: ./dist

  deploy:
    needs: build
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - uses: actions/deploy-pages@v4
        id: deployment
Original prompt

The repository Grar00t/gratech-ai-dashboard is a React + Vite application, but the GitHub Pages deployment is failing because it defaults to a Jekyll build.
The error in run 19761033179 is: No such file or directory @ dir_chdir0 - /github/workspace/docs.

Task:
Create a new GitHub Actions workflow file named .github/workflows/deploy.yml to correctly build and deploy the Vite application to GitHub Pages.

The workflow should:

  1. Trigger on push to the main branch.
  2. Set permissions for contents: read, pages: write, and id-token: write.
  3. Have a build job that:
    • Runs on ubuntu-latest.
    • Checks out the code using actions/checkout@v4.
    • Sets up Node.js using actions/setup-node@v4 with node-version 20.
    • Installs dependencies (npm ci).
    • Builds the project (npm run build).
    • Uploads the pages artifact using actions/upload-pages-artifact@v3 with path: ./dist.
  4. Have a deploy job that:
    • Needs the build job.
    • Sets the environment to github-pages with url ${{ steps.deployment.outputs.page_url }}.
    • Deploys to GitHub Pages using actions/deploy-pages@v4.

This pull request was created as a result of the following prompt from Copilot chat.

The repository Grar00t/gratech-ai-dashboard is a React + Vite application, but the GitHub Pages deployment is failing because it defaults to a Jekyll build.
The error in run 19761033179 is: No such file or directory @ dir_chdir0 - /github/workspace/docs.

Task:
Create a new GitHub Actions workflow file named .github/workflows/deploy.yml to correctly build and deploy the Vite application to GitHub Pages.

The workflow should:

  1. Trigger on push to the main branch.
  2. Set permissions for contents: read, pages: write, and id-token: write.
  3. Have a build job that:
    • Runs on ubuntu-latest.
    • Checks out the code using actions/checkout@v4.
    • Sets up Node.js using actions/setup-node@v4 with node-version 20.
    • Installs dependencies (npm ci).
    • Builds the project (npm run build).
    • Uploads the pages artifact using actions/upload-pages-artifact@v3 with path: ./dist.
  4. Have a deploy job that:
    • Needs the build job.
    • Sets the environment to github-pages with url ${{ steps.deployment.outputs.page_url }}.
    • Deploys to GitHub Pages using actions/deploy-pages@v4.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: Grar00t <239743497+Grar00t@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GitHub Actions workflow for deploying Vite app Add GitHub Actions workflow for Vite app deployment to GitHub Pages Dec 2, 2025
@Grar00t SULIMAN ALSHAMMARI (Grar00t) marked this pull request as ready for review December 15, 2025 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants