Skip to content

Commit 22c66ba

Browse files
committed
Add build workflow
1 parent 41dbcc8 commit 22c66ba

2 files changed

Lines changed: 46 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# .github/workflows/build.yml
2+
name: Build and Deploy
3+
4+
on:
5+
push:
6+
branches:
7+
- vite
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout vite branch
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 20.19.0
23+
24+
- name: Install dependencies
25+
run: yarn install --frozen-lockfile
26+
27+
- name: Build project
28+
run: yarn run build
29+
30+
- name: Deploy dist to build branch
31+
run: |
32+
git config user.name "github-actions[bot]"
33+
git config user.email "github-actions[bot]@users.noreply.github.com"
34+
35+
git fetch origin build:build || git branch build
36+
37+
git checkout build
38+
39+
find . -mindepth 1 -not -name ".git" -exec rm -rf {} +
40+
41+
cp -r ../dist/* .
42+
43+
git add .
44+
git commit -m "Deploy build from ${GITHUB_SHA}" || echo "No changes to commit"
45+
git push origin build

0 commit comments

Comments
 (0)