-
-
Notifications
You must be signed in to change notification settings - Fork 5
57 lines (48 loc) · 1.46 KB
/
build.yml
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
name: CI
on:
push:
tags:
- "v*" # Or trigger on tags starting with 'v' (e.g., v1.0.0)
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
name: Checkout src repo
with:
path: src
fetch-depth: 0
ref: main
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x" # Or your desired version
- name: Install dependencies
run: npm install
working-directory: src
- name: Build
run: npm run build
working-directory: src
# Checkout destination repository
- name: Checkout dest repo
uses: actions/checkout@v2
with:
path: dest
fetch-depth: 0
ref: gh-pages
# Copy the built website files
- name: Copy website built from src/public folder
working-directory: dest
run: |
rm -rf *
yes | cp -rf ../src/public/* . # Replace '(output_folder)' with your build output dir
# Commit and push changes
- name: Commit website updates
working-directory: dest
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
git add .
git diff-index --quiet HEAD || git commit -m "Deploy website updates with GitHub Actions: ${GITHUB_SHA}"
git push origin gh-pages