Skip to content

Commit ef62aff

Browse files
feat: add GitHub Actions workflow for deploying to GitHub Pages and update npm scripts for Vite
1 parent ede74d7 commit ef62aff

2 files changed

Lines changed: 61 additions & 1 deletion

File tree

.github/workflows/CD.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Deploy Support-Us-Button to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 22
31+
cache: npm
32+
33+
- name: Setup Pages
34+
uses: actions/configure-pages@v5
35+
36+
- name: Install dependencies
37+
run: npm ci
38+
39+
- name: Build
40+
run: npm run vite:build
41+
42+
- name: Upload artifact
43+
uses: actions/upload-pages-artifact@v3
44+
with:
45+
path: ./dist
46+
47+
deploy:
48+
environment:
49+
name: github-pages
50+
url: ${{ steps.deployment.outputs.page_url }}
51+
52+
runs-on: ubuntu-latest
53+
needs: build
54+
55+
steps:
56+
- name: Deploy to GitHub Pages
57+
id: deployment
58+
uses: actions/deploy-pages@v4

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858
"build:js": "rollup -c",
5959
"build": "npm run build:css && npm run build:js",
6060
"dev": "rollup -c -w",
61-
"dev:demo": "vite",
61+
"vite:dev": "vite",
62+
"vite:build": "vite build",
63+
"vite:preview": "vite preview",
6264
"type-check": "tsc --noEmit",
6365
"test": "npm run type-check && vitest run --passWithNoTests",
6466
"prepublishOnly": "npm run build"

0 commit comments

Comments
 (0)