Yarn Build CI #24
Workflow file for this run
This file contains 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
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | |
# name: Publish to AliyunOSS | |
# on: | |
# push: | |
# branches: | |
# - "deploy" | |
# jobs: | |
# build: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - uses: actions/setup-node@v2 | |
# with: | |
# node-version: 14 | |
# - run: yarn install | |
# - run: yarn run build | |
# - name: Upload AliyunOSS | |
# uses: fangbinwei/aliyun-oss-website-action@v1 | |
# with: | |
# accessKeyId: ${{ secrets.ACCESS_KEY_ID }} | |
# accessKeySecret: ${{ secrets.ACCESS_KEY_SECRET }} | |
# bucket: "yaklang-io" | |
# endpoint: "oss-accelerate-overseas.aliyuncs.com" | |
# folder: "./build" | |
# 新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: yarn install | |
- run: yarn run generate | |
# 静态文件压缩 | |
- name: pack out file | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
run: tar -zcvf out.tar.gz ./dist | |
- name: Upload out ssh | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
uses: easingthemes/[email protected] | |
with: | |
REMOTE_USER: 'root' | |
REMOTE_HOST: '${{ secrets.MEGEVECTOR_HOST }}' #测试服务器地址 | |
SSH_PRIVATE_KEY: ${{ secrets.MEGEVECTOR_KEY }} | |
ARGS: "-avzr --delete" | |
SOURCE: "out.tar" | |
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.MEGEVECTOR_KEY }} | |
script: | | |
cd /root/wanjing-megavector/ | |
tar -zxvf out.tar -C . |