ErickKS / vite-deploy

Guide for vite react app deploy
330 stars 60 forks source link

yml not up to date #3

Open Atharva-Karhale opened 8 months ago

Atharva-Karhale commented 8 months ago

This process worked fine till now but automatically yesterday my website stopped working and there was an error "404".

Also this is the warning displayed on the deploy logs of the GitHub pages "deploy Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/setup-node@v3, actions/configure-pages@v3, actions/upload-artifact@v3, actions/deploy-pages@v2. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/."

Atharva-Karhale commented 8 months ago

The below mentioned .yml worked for me which uses a newer version of node (i.e. node-version 18 rather than the node-version 16 mentioned in this repo).

Simple workflow for deploying static content to GitHub Pages

name: Deploy static content to Pages

on:

Runs on pushes targeting the default branch

push: branches: ['main']

Allows you to run this workflow manually from the Actions tab

workflow_dispatch:

Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages

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

Allow one concurrent deployment

concurrency: group: 'pages' cancel-in-progress: true

jobs:

Single deploy job since we're just deploying

deploy: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps:

vempr commented 6 months ago

wouldn't it be easier to use jekyll?

dipanjal commented 1 month ago

Updated deployment YAML

name: Deploy

on:
  push:
    branches:
      - main

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repo
        uses: actions/checkout@v3

      - name: Setup Node
        uses: actions/setup-node@v3

      - name: Install dependencies
        uses: bahmutov/npm-install@v1

      - name: Build project
        run: npm run build

      - name: Upload production-ready build files
        uses: actions/upload-artifact@v3
        with:
          name: production-files
          path: ./dist

  deploy:
    name: Deploy
    needs: build
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main'

    steps:
      - name: Download artifact
        uses: actions/download-artifact@v3
        with:
          name: production-files
          path: ./dist

      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./dist