-
Notifications
You must be signed in to change notification settings - Fork 12
85 lines (72 loc) · 2.34 KB
/
publish-to-oss.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# 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:
# - "master"
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: 16.13
# 打包
- name: build
run: yarn install
- run: yarn run build
# 静态文件压缩
- name: pack out file
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: tar -zcvf out.tgz build
- name: Upload out ssh
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: easingthemes/ssh-deploy@v2.1.6
with:
REMOTE_USER: 'root'
REMOTE_HOST: '${{ secrets.ONLINE_HOST }}' #测试服务器地址
SSH_PRIVATE_KEY: ${{ secrets.ONLINE_PRIV_KEY }}
ARGS: "-avzr --delete"
SOURCE: "out.tgz"
TARGET: '/root/yaklang-io/' #服务器中,代码部署的位置
- name: Deploy
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: appleboy/ssh-action@master # 使用ssh链接服务器
with:
host: ${{ secrets.ONLINE_HOST }}
username: 'root'
key: ${{ secrets.ONLINE_PRIV_KEY }}
script: |
cd /root/yaklang-io/
tar zxvf out.tgz
rm -rf out.tgz