-
Notifications
You must be signed in to change notification settings - Fork 44
55 lines (47 loc) · 1.46 KB
/
auto-build.yml
File metadata and controls
55 lines (47 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Auto Build Bundle
on:
push:
branches:
- main
paths:
- 'scripts/**'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: true
fetch-depth: 0
submodules: 'recursive'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm ci
- name: Ensure git submodules are initialized
run: |
# Sync and fetch submodules (recursive) so referenced repos are available for build
git submodule sync --recursive || true
git submodule update --init --recursive --remote
- name: Build bundle
run: npm run update
- name: Commit and push bundle.js if changed
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Only commit if bundle.js changed
if [[ -n "$(git status --porcelain bundle.js)" ]]; then
git add bundle.js
git add index.html
git commit -m "chore: rebuild bundle.js (auto)" || echo "no commit"
git push origin HEAD:refs/heads/main
else
echo "bundle.js unchanged"
fi