2024-03-26 19:44:28 +08:00
|
|
|
name: master分支构建发布到公网服务器
|
2024-03-26 17:13:36 +08:00
|
|
|
run-name: ${{ gitea.actor }} is testing out Gitea Actions
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2024-03-26 17:31:03 +08:00
|
|
|
- master
|
2024-03-26 17:13:36 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
Build-Publish:
|
|
|
|
runs-on: joylink-local233
|
|
|
|
steps:
|
|
|
|
- name: 检出代码
|
|
|
|
uses: https://gitea.joylink.club/actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
- name: 设置node环境
|
|
|
|
uses: https://gitea.joylink.club/actions/local-setup-node@v0.1.1
|
|
|
|
with:
|
|
|
|
version: 'v14.21.3'
|
|
|
|
cache: 'yarn'
|
|
|
|
cache-dependency-path: 'yarn.lock'
|
|
|
|
- name: 安装yarn,并build
|
|
|
|
run: |
|
|
|
|
node -v
|
|
|
|
npm config set registry https://registry.npmmirror.com
|
2024-03-26 17:57:39 +08:00
|
|
|
npm install --global yarn
|
2024-03-26 17:13:36 +08:00
|
|
|
yarn config set registry https://registry.npmmirror.com
|
|
|
|
yarn
|
2024-03-26 17:31:03 +08:00
|
|
|
yarn run build
|
|
|
|
tar czvf ./dist-master.tar.gz ./dist
|
2024-03-26 19:44:28 +08:00
|
|
|
- name: 打包发送到服务器
|
2024-03-26 17:13:36 +08:00
|
|
|
uses: https://gitea.joylink.club/appleboy/scp-action@v0.1.7
|
|
|
|
with:
|
2024-03-26 17:31:03 +08:00
|
|
|
host: ${{ secrets.PUB1_DOMAIN_SSH_HOST }}
|
|
|
|
port: ${{ secrets.PUB1_DOMAIN_SSH_PORT }}
|
|
|
|
username: ${{ secrets.PUB1_DOMAIN_SSH_USER }}
|
|
|
|
password: ${{ secrets.PUB1_DOMAIN_SSH_PASSWORD }}
|
|
|
|
source: ./dist-master.tar.gz
|
|
|
|
target: /mnt/data/published/rt-sim-training-client
|
2024-03-26 17:13:36 +08:00
|
|
|
overwrite: true
|
2024-03-26 19:44:28 +08:00
|
|
|
- name: SSH连接并解压发布
|
2024-03-26 17:13:36 +08:00
|
|
|
uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3
|
|
|
|
with:
|
2024-03-26 17:31:03 +08:00
|
|
|
host: ${{ secrets.PUB1_DOMAIN_SSH_HOST }}
|
|
|
|
port: ${{ secrets.PUB1_DOMAIN_SSH_PORT }}
|
|
|
|
username: ${{ secrets.PUB1_DOMAIN_SSH_USER }}
|
|
|
|
password: ${{ secrets.PUB1_DOMAIN_SSH_PASSWORD }}
|
2024-03-26 17:13:36 +08:00
|
|
|
script: |
|
2024-03-26 17:31:03 +08:00
|
|
|
cd /mnt/data/published/rt-sim-training-client
|
2024-03-26 17:13:36 +08:00
|
|
|
rm -rf /usr/local/joylink/client/cbtc
|
|
|
|
mkdir -p /usr/local/joylink/client
|
2024-03-26 17:31:03 +08:00
|
|
|
tar xz --strip 2 -C /usr/local/joylink/client -f dist-master.tar.gz
|