Skip to content

Commit

Permalink
init cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
lijingze committed Feb 3, 2024
1 parent 92cf56a commit f811615
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: 更新项目到服务器

on:
push:
# push 代码的时候 哪个分支会受到影响 这里是 v1.0.0 分支
branches:
- main # 也可以设置为 main 分支

# 推送之后执行一系列的任务
jobs:
build:
runs-on: ubuntu-latest
steps:
# 获取代码
- name: 迁出代码
# 使用action库 action/checkout获取代码
uses: actions/checkout@main
# 安装Node环境

- name: Use Node.js 18.12.1
uses: actions/setup-node@main
with:
node-version: "18.12.1"

# 安装依赖
- name: 安装依赖
run: npm install

# 打包
- name: 打包
run: npm run build
# 上传到腾讯云
- name: 发布到阿里云
uses: easingthemes/ssh-deploy@main
env:
# 私钥
SSH_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
# SCP参数
ARGS: "-avzr --delete"
# 源目录
SOURCE: "dist/"
# 服务器ip
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
# 用户
REMOTE_USER: "root"
# 目标地址
# TARGET: '/var/www/html'
TARGET: "/home/web"
# 推送信息到微信
# - name: 推送信息到微信
# uses: easychen/github-action-server-chan@main
# with:
# sendkey: ${{ secrets.SERVER_J }}
# title: '网站更新完毕'
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# vitepress-notes
Use vitepress to record study notes for learning front-end related knowledge

- [x] init
- [x] ci/cd

0 comments on commit f811615

Please sign in to comment.