Skip to content

Yarn Build CI

Yarn Build CI #52

Workflow file for this run

# 新Github-Ci
name: Yarn Build CI
on:
push:
# branches:
# - "main"
tags:
- "v*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
# 打包
- name: build
run: npm install
- run: npm run generate
# 静态文件压缩
- name: pack out file
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: tar -zcvf public.tar.gz .output/public/
- name: Upload out ssh
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: easingthemes/ssh-deploy@main
with:
REMOTE_USER: 'root'
REMOTE_HOST: '${{ secrets.MEGEVECTOR_HOST }}' #测试服务器地址
SSH_PRIVATE_KEY: ${{ secrets.REPOSITORY_PRIVATE_KEY }}
ARGS: "-avzr --delete"
SOURCE: "public.tar.gz"
TARGET: '/root/wanjing-megavector/' #服务器中,代码部署的位置
- name: Deploy
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: appleboy/ssh-action@master # 使用ssh链接服务器
with:
host: ${{ secrets.MEGEVECTOR_HOST }}
username: 'root'
key: ${{ secrets.REPOSITORY_PRIVATE_KEY }}
script: |
cd /root/wanjing-megavector/
tar -xzvf public.tar.gz
rm -r public.tar.gz
rm -r output
mv -f .output/ output/