-
Notifications
You must be signed in to change notification settings - Fork 8
66 lines (56 loc) · 1.8 KB
/
Copy pathdeploy.yml
File metadata and controls
66 lines (56 loc) · 1.8 KB
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
name: 部署到 Server
on:
push:
branches:
- main
- master
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: deploy-server
cancel-in-progress: false
jobs:
build:
if: ${{ github.repository_owner == 'MaaXYZ' && github.event.head_commit.author.email != '41898282+github-actions[bot]@users.noreply.github.com' }}
runs-on: ubuntu-latest
steps:
- name: 检出代码
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
fetch-depth: 0
fetch-tags: true
- name: 安装 pnpm
uses: pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa # v4
with:
version: 10.34.5
run_install: false
- name: 安装 Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: 安装依赖
run: pnpm install --frozen-lockfile
- name: 更新版本号
run: |
ver=$(git describe --tags --long --match "v*" 2>/dev/null || echo "v0.0.1-0-g$(git rev-parse --short HEAD)")
ver=${ver#v}
echo "Setting version to ${ver}"
pnpm run version -- "${ver}"
- name: 构建
run: pnpm run build
env:
MLA_UMAMI_WEBSITE_ID: ${{ vars.UMAMI_WEBSITE_ID }}
- name: Deploy to Server
uses: easingthemes/ssh-deploy@a1aa0b6cf96ce2406eef90faa35007a4a7bf0ac0 # v5.1.1
env:
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_KEY }}
REMOTE_HOST: ${{ secrets.DEPLOY_HOST }}
REMOTE_USER: ${{ secrets.DEPLOY_USERNAME }}
TARGET: ${{ secrets.DEPLOY_PATH }}
SOURCE: dist
# ARGS: -avzr --delete