-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (50 loc) · 1.76 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
name: kenan actions
on:
push:
branches: [ "main" ]
# Environment variables available to all jobs and steps in this workflow
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@v4
- name: node install
uses: actions/[email protected]
with:
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.
node-version: "20.X" # optional
- name: INSTALL NODE MODULES
run: npm i
- name: Build
run: npm run build
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
# if: ${{ github.ref == 'refs/heads/main' }}
with:
branch: gh-pages # 这个是存储你项目打包后的文件分支
folder: dist
# token: ${{ secrets.TOKEN }}
- name: Deploy to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
password: ${{ secrets.REMOTE_PASS }}
port: ${{ secrets.REMOTE_PORT }}
script: |
git config pull.rebase false # 这种策略会创建一个新的合并提交,将本地和远程的更改合并在一起。
cd /www/wwwroot/8.152.0.253/something0408 # 替换为您的项目在服务器上的位置
git pull origin gh-pages # 拉取最新代码
# - name: copy dist file with scp
# uses: appleboy/[email protected]
# with:
# host: ${{ secrets.REMOTE_HOST }}
# username: ${{ secrets.REMOTE_USER }}
# password: ${{ secrets.REMOTE_PASS }}
# port: 22
# source: 'dist/'
# target: '/www/wwwroot/8.152.0.253/something0408/'