-
-
Notifications
You must be signed in to change notification settings - Fork 125
65 lines (62 loc) · 2.45 KB
/
node.js.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
58
59
60
61
62
63
64
65
# 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
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: JavaScript CI with Node.js
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [ 16.x ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: "./ui/package-lock.json"
- name: Cache Clean UI
run: npm cache clean --force
- name: Install UI
run: npm install --prefix ./ui
- name: Build UI
run: npm run build --prefix ./ui
- name: Build the Docker image
run: |
# 登录阿里云镜像仓库
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }} registry.cn-shenzhen.aliyuncs.com
# ========== 构建UI ==========
cd ui
# 使用Dockerfile构建镜像
docker build . --file Dockerfile --tag registry.cn-shenzhen.aliyuncs.com/koushenhai/ui:3.4.1
# 推送镜像到镜像仓库
docker push registry.cn-shenzhen.aliyuncs.com/koushenhai/ui:3.4.1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: "./archive/package-lock.json"
- name: Cache Clean Doc
run: npm cache clean --force
- name: Install Doc
run: npm install --prefix ./archive
- name: Build Doc
run: npm run build --prefix ./archive
- name: Publish Doc
uses: cpina/github-action-push-to-another-repository@v1.6
env:
API_TOKEN_GITHUB: ${{ secrets.USER_TOKEN }}
with:
target-branch: 'main'
source-directory: './archive/docs/.vuepress/dist'
destination-github-username: 'KouShenhai'
destination-repository-name: 'koushenhai.github.io'
user-email: 2413176044@qq.com