perf:新增路由懒加载性能优化 #29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test-deploy.yml | |
name: Deploy with docker | |
# 手动构建 | |
#on: workflow_dispatch | |
on: | |
push: | |
# 分支 | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
# 运行的环境 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] #选择你需要的nodejs版本 | |
# 步骤 | |
steps: | |
- uses: actions/checkout@v3 # git pull | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- run: npm install | |
- run: npm run build | |
# 登录Docker Hub | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
#build镜像并push到中央仓库中 | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
push: true | |
tags: ${{secrets.DOCKER_HUB_USERNAME}}/front:latest | |
# push后,用ssh连接服务器执行脚本 | |
- name: SSH | |
# uses: fifsky/ssh-action@master | |
uses: appleboy/ssh-action@master | |
with: | |
# command: | | |
# cd /develop/work/education-back-server | |
# sh start.sh | |
host: ${{secrets.SERVER_HOST}} | |
username: ${{secrets.SERVER_USERNAME}} | |
port: ${{secrets.SERVER_PORT }} | |
# key: ${{secrets.SERVER_PRIVATE_KEY}} | |
password: ${{secrets.SERVER_PASSWORD}} | |
script: | |
sh /develop/work/education-front/start.sh | |