From 85e8f84b8b87c16dbea2fb220148a2de765e0f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=BE=81=E8=BE=89?= <343196323@qq.com> Date: Tue, 18 Jun 2024 01:03:34 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=8E=20ci:=20Github=20Actions=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/push.yml diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..4d10fc4 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,48 @@ +name: 打包应用并上传腾讯云 + +on: + push: + branches: + - master + +jobs: + build: + # runs-on 指定job任务运行所需要的虚拟机环境(必填字段) + runs-on: ubuntu-latest + steps: + # 获取源码 + - name: 迁出代码 + # 使用action库 actions/checkout获取源码 + uses: actions/checkout@master + + # 安装Node10 + - name: 安装node.js + # 使用action库 actions/setup-node安装node + uses: actions/setup-node@v1 + with: + node-version: 18.20.2 + + # 安装依赖 + - name: 安装依赖 + run: npm install + + # 打包 + - name: 打包 + run: npm run build + + # 上传阿里云 + - name: 发布到腾讯云 + uses: easingthemes/ssh-deploy@v2.1.1 + env: + # 私钥 + SSH_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + # scp参数 + ARGS: "-avzr --delete" + # 源目录 + SOURCE: "dist" + # 服务器ip:换成你的服务器IP + REMOTE_HOST: ${{ secrets.REMOTE_HOST }} + # 用户 + REMOTE_USER: "root" + # 目标地址 + TARGET: "/www/wwwroot"