Skip to content

Commit 8a309eb

Browse files
committed
Add build workflow
1 parent 41dbcc8 commit 8a309eb

5 files changed

Lines changed: 55 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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: Fetch build branch history
20+
run: |
21+
rm -rf dist
22+
git clone --branch build --single-branch "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" dist
23+
24+
cd dist
25+
26+
git checkout build
27+
git fetch
28+
29+
find . -mindepth 1 -maxdepth 1 ! -path "./.git" -type d -exec rm -rf {} +
30+
find . -mindepth 1 -maxdepth 1 ! -path "./.git" -type f -exec rm -rf {} +
31+
32+
- name: Set up Node.js
33+
uses: actions/setup-node@v3
34+
with:
35+
node-version: 20.19.0
36+
37+
- name: Install dependencies
38+
run: yarn install --frozen-lockfile
39+
40+
- name: Build project
41+
run: yarn run build
42+
43+
- name: Deploy dist to build branch
44+
run: |
45+
cd dist
46+
47+
git config user.name "github-actions[bot]"
48+
git config user.email "github-actions[bot]@users.noreply.github.com"
49+
50+
git add .
51+
git commit -m "Deploy to build from ${GITHUB_SHA}" || echo "Nothing to commit"
52+
git push --force "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" build

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ node_modules
1111
dist
1212
dist-ssr
1313
*.local
14+
tsconfig.tsbuildinfo
1415

1516
# Editor directories and files
1617
.vscode/*

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,5 +272,5 @@
272272
</div>
273273
</template>
274274

275-
<script src="./src/main.ts" type="module"></script>
275+
<script src="./src/Main.ts" type="module"></script>
276276
</html>

src/iframe.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ document.addEventListener("DOMContentLoaded", () => {
6565

6666
window.addEventListener("keyup", (e) => {
6767
if (e.key === "Escape") {
68+
e.preventDefault();
6869
window.nlBabyMonitor.onCancel();
6970
}
7071
});

tsconfig.tsbuildinfo

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)