-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (63 loc) · 1.82 KB
/
main.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
name: Publish And Deploy Demo
defaults:
run:
working-directory: ./3.vue/5.server-render/nuxt-realworld
on:
push:
tags:
- v-realworld*
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# 下载源码
- name: Checkout
uses: actions/checkout@master
# 打包构建
- name: SetUp nodejs
uses: actions/setup-node@master
# 安装pnpm
- name: Install pnpm
run: npm install -g pnpm
# 安装依赖
- name: Install Dep
run: pnpm install
- name: Build
run: pnpm run build
- name: Compress
run: tar -zcvf release.tgz .output ecosystem.config.js
# 发布 Release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
# 上传构建结果到 Release
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./3.vue/5.server-render/nuxt-realworld/release.tgz
asset_name: release.tgz
asset_content_type: application/x-tgz
# 部署到服务器
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
cd /root/web/nuxt-realworld
wget https://github.com/laoriy/lagou-study/releases/latest/download/release.tgz -O release.tgz
tar zxvf release.tgz
pm2 reload ecosystem.config.js