Skip to content

Commit

Permalink
✨ add gh-pages deploy and build script
Browse files Browse the repository at this point in the history
  • Loading branch information
slooi committed Sep 7, 2024
1 parent f1204d1 commit 2d3c7cf
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy Vite App to GitHub Pages

on:
push:
branches: [master]

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

- name: Deploy to GitHub Pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git checkout --orphan gh-pages
git --work-tree dist add --all
git --work-tree dist commit -m "Deploy to GitHub Pages"
git push origin HEAD:gh-pages --force
rm -rf dist
git checkout -f main
git branch -D gh-pages

0 comments on commit 2d3c7cf

Please sign in to comment.