Skip to content

Workflow file for this run

# 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