-
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 2.17 KB
/
build.yml
File metadata and controls
78 lines (67 loc) · 2.17 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
name: Build
on:
push:
branches:
- master
pull_request:
schedule:
- cron: '0 0 * * *' # Daily at midnight UTC
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
- name: Install dependencies
run: npm install --ignore-scripts
- name: Validate JSON files
run: npm run validate
- name: Lint JavaScript files
run: npm run lint
- name: Build indexes
run: npm run build
- name: Upload dist artifacts
uses: actions/upload-artifact@v6
with:
if-no-files-found: 'error'
name: dist
path: dist/
publish:
needs: build
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'schedule'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Download dist artifacts
uses: actions/download-artifact@v7
with:
name: dist
path: dist/
- name: Publish to dist branch
env:
GH_BOT_NAME: ${{ secrets.GH_BOT_NAME }}
GH_BOT_EMAIL: ${{ secrets.GH_BOT_EMAIL }}
GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
run: |
git config --global user.name "${GH_BOT_NAME}"
git config --global user.email "${GH_BOT_EMAIL}"
git clone --single-branch --branch dist \
"https://x-access-token:${GH_BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" dist-repo \
|| git clone "https://x-access-token:${GH_BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" dist-repo
cd dist-repo
git checkout dist 2>/dev/null || git checkout --orphan dist
git rm -rf . 2>/dev/null || true
cp -r ../dist/* .
git add .
git diff --staged --quiet || git commit -m "build: update dist from ${GITHUB_SHA}"
git push "https://x-access-token:${GH_BOT_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" dist