Skip to content

Commit 8ab0dbf

Browse files
committed
ci: automatic deployments
1 parent fcc5f4a commit 8ab0dbf

File tree

5 files changed

+328
-1
lines changed

5 files changed

+328
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Deploy example
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
19+
- uses: pnpm/action-setup@v4
20+
21+
- name: Install & Build
22+
run: |
23+
pnpm install
24+
pnpm build
25+
26+
- name: Generate example
27+
run: pnpm run example
28+
29+
- name: Deploy with gh-pages
30+
run: |
31+
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
32+
pnpm run deploy -u "github-actions-bot <[email protected]>"
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ coverage
55
.custom-report-directory
66
.test-plugin
77
.DS_store
8+
example

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@
1818
"scripts": {
1919
"build": "rm -rf ./dist && tsc --project tsconfig.build.json && cp src/*.css dist",
2020
"test": "vitest --coverage",
21-
"typecheck": "tsc --noEmit"
21+
"typecheck": "tsc --noEmit",
22+
"example": "node scripts/generate-example.mjs",
23+
"deploy": "touch example/.nojekyll && gh-pages --dist example --dotfiles true"
2224
},
2325
"peerDependencies": {
2426
"vite": ">=4"
2527
},
2628
"devDependencies": {
2729
"@types/node": "^22.4.1",
2830
"@vitest/coverage-v8": "^2.0.5",
31+
"gh-pages": "^6.1.1",
2932
"magic-string": "^0.30.11",
3033
"typescript": "^5.5.4",
3134
"vite": "^5.4.0",

0 commit comments

Comments
 (0)