Skip to content

Commit 67db2f7

Browse files
build with github actions
1 parent 1c23e21 commit 67db2f7

File tree

2 files changed

+56
-63
lines changed

2 files changed

+56
-63
lines changed

.github/workflows/build.yml

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,66 @@
1-
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3-
41
name: build
52

63
on:
74
push:
8-
branches: [ "master" ]
9-
pull_request:
10-
branches: [ "master" ]
5+
branches: [master]
116

127
jobs:
138
build:
14-
9+
name: Build & Deploy Docs Site
1510
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 22.8.0
19+
cache: 'npm'
1620

17-
strategy:
18-
matrix:
19-
node-version: [18.x, 20.x, 22.x]
20-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21+
- name: Setup Java
22+
uses: actions/setup-java@v4
23+
with:
24+
distribution: zulu
25+
java-version: 8
2126

22-
steps:
23-
- uses: actions/checkout@v4
24-
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v4
26-
with:
27-
node-version: ${{ matrix.node-version }}
28-
cache: 'npm'
29-
- run: npm ci
30-
- run: npm run build --if-present
31-
- run: npm test
27+
- name: Setup Gradle
28+
uses: gradle/actions/setup-gradle@v3
29+
30+
- name: Build Theme
31+
working-directory: ./themes/doc
32+
run: |
33+
npm ci
34+
npx webpack --mode production
35+
36+
- name: Build HTML
37+
run: |
38+
npm ci
39+
npx hexo generate
40+
echo "www.ktorm.org" > "./public/CNAME"
41+
42+
- name: Build Dokka HTML
43+
run: |
44+
BASEDIR=$(pwd)
45+
PROJECT_DIR=~/.ktorm-docs/temp/repo/ktorm
46+
git clone --depth=1 --branch=master https://github.com/kotlin-orm/ktorm.git "$PROJECT_DIR"
47+
cd "$PROJECT_DIR" && ./gradlew dokkaHtmlMultiModule -Ddokka.templatesDir="$BASEDIR/dokka/templates"
48+
cp -r "$PROJECT_DIR/build/dokka/htmlMultiModule" "$BASEDIR/public/api-docs"
49+
50+
- name: Deploy
51+
run: |
52+
BASEDIR=$(pwd)
53+
DEPLOY_DIR=~/.ktorm-docs/temp/repo/ktorm-docs
54+
55+
git clone --depth=1 --branch=gh-pages https://github.com/kotlin-orm/ktorm-docs.git "$DEPLOY_DIR"
56+
cd "$DEPLOY_DIR"
57+
git rm -rf .
58+
cp -r "$BASEDIR/public/." "$DEPLOY_DIR"
59+
60+
if [[ `git status --porcelain` ]]; then
61+
git config user.name 'vince'
62+
git config user.email 'me@liuwj.me'
63+
git add .
64+
git commit -m "[github actions] deploy the site"
65+
git push "https://$GIT_PUSH_TOKEN@github.com/kotlin-orm/ktorm-docs.git" gh-pages
66+
fi

deploy.sh

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)