提交 | 用户 | age
|
c303ec
|
1 |
name: deploy |
V |
2 |
|
|
3 |
on: |
|
4 |
push: |
|
5 |
branches: |
|
6 |
- main |
|
7 |
|
|
8 |
jobs: |
ee5fb2
|
9 |
# push-to-ftp: |
V |
10 |
# if: "contains(github.event.head_commit.message, '[deploy]')" |
|
11 |
# runs-on: ubuntu-latest |
|
12 |
# steps: |
|
13 |
# - name: Checkout |
|
14 |
# uses: actions/checkout@v2 |
8ccf77
|
15 |
|
ee5fb2
|
16 |
# - name: Sed Config Base |
V |
17 |
# shell: bash |
|
18 |
# run: | |
|
19 |
# sed -i 's#VITE_PUBLIC_PATH\s*=.*#VITE_PUBLIC_PATH = /next/#g' ./.env.production |
|
20 |
# sed -i "s#VITE_BUILD_COMPRESS\s*=.*#VITE_BUILD_COMPRESS = 'gzip'#g" ./.env.production |
|
21 |
# cat ./.env.production |
8ccf77
|
22 |
|
ee5fb2
|
23 |
# - name: use Node.js 14 |
V |
24 |
# uses: actions/setup-node@v2.1.2 |
|
25 |
# with: |
|
26 |
# node-version: '14.x' |
8ccf77
|
27 |
|
ee5fb2
|
28 |
# - name: Get yarn cache |
V |
29 |
# id: yarn-cache |
|
30 |
# run: echo "::set-output name=dir::$(yarn cache dir)" |
8ccf77
|
31 |
|
ee5fb2
|
32 |
# - name: Cache dependencies |
V |
33 |
# uses: actions/cache@v2 |
|
34 |
# with: |
|
35 |
# path: ${{ steps.yarn-cache.outputs.dir }} |
|
36 |
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
|
37 |
# restore-keys: | |
|
38 |
# ${{ runner.os }}-yarn- |
8ccf77
|
39 |
|
ee5fb2
|
40 |
# - name: Build |
V |
41 |
# run: | |
|
42 |
# yarn install |
|
43 |
# yarn run build |
8ccf77
|
44 |
|
ee5fb2
|
45 |
# - name: Deploy |
V |
46 |
# uses: SamKirkland/FTP-Deploy-Action@2.0.0 |
|
47 |
# env: |
|
48 |
# FTP_SERVER: ${{ secrets.FTP_SERVER }} |
|
49 |
# FTP_USERNAME: ${{ secrets.FTP_USERNAME }} |
|
50 |
# FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} |
|
51 |
# METHOD: sftp |
|
52 |
# PORT: ${{ secrets.FTP_PORT }} |
|
53 |
# LOCAL_DIR: dist |
|
54 |
# REMOTE_DIR: /srv/www/vben-admin |
|
55 |
# ARGS: --delete --verbose --parallel=80 |
8ccf77
|
56 |
|
5cc948
|
57 |
push-to-gh-pages: |
8ccf77
|
58 |
runs-on: ubuntu-latest |
V |
59 |
steps: |
|
60 |
- name: Checkout |
cb2898
|
61 |
uses: actions/checkout@v3 |
8ccf77
|
62 |
|
1108d7
|
63 |
# - uses: NullVoxPopuli/action-setup-pnpm@v2 |
J |
64 |
|
8ccf77
|
65 |
- name: Sed Config Base |
V |
66 |
shell: bash |
|
67 |
run: | |
|
68 |
sed -i "s#VITE_BUILD_COMPRESS\s*=.*#VITE_BUILD_COMPRESS = 'gzip'#g" ./.env.production |
476b2b
|
69 |
sed -i "s#VITE_DROP_CONSOLE\s*=.*#VITE_DROP_CONSOLE = true#g" ./.env.production |
8ccf77
|
70 |
cat ./.env.production |
V |
71 |
|
34237e
|
72 |
- name: Install pnpm |
G |
73 |
uses: pnpm/action-setup@v2 |
1108d7
|
74 |
with: |
244eeb
|
75 |
version: 8.1 |
1108d7
|
76 |
run_install: false |
34237e
|
77 |
|
c69996
|
78 |
- name: use Node.js 16 |
cb2898
|
79 |
uses: actions/setup-node@v3 |
8ccf77
|
80 |
with: |
e6c820
|
81 |
node-version: '20.x' |
8ccf77
|
82 |
|
e6c820
|
83 |
# - name: Get yarn cache directory path |
J |
84 |
# id: yarn-cache-dir-path |
|
85 |
# run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT |
|
86 |
# |
|
87 |
# - name: Cache dependencies |
|
88 |
# uses: actions/cache@v3 |
|
89 |
# with: |
|
90 |
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
|
91 |
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
|
92 |
# restore-keys: | |
|
93 |
# ${{ runner.os }}-yarn- |
8ccf77
|
94 |
|
V |
95 |
- name: Set SSH Environment |
|
96 |
env: |
908a2f
|
97 |
DOCS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }} |
8ccf77
|
98 |
run: | |
V |
99 |
mkdir -p ~/.ssh/ |
908a2f
|
100 |
echo "$ACTIONS_DEPLOY_KEY" > ~/.ssh/id_rsa |
8ccf77
|
101 |
chmod 600 ~/.ssh/id_rsa |
V |
102 |
ssh-keyscan github.com > ~/.ssh/known_hosts |
|
103 |
chmod 700 ~/.ssh && chmod 600 ~/.ssh/* |
93d465
|
104 |
git config --global user.email "vbenadmin@163.com" |
V |
105 |
git config --global user.name "vbenAdmin" |
8ccf77
|
106 |
|
V |
107 |
- name: Build |
c999ab
|
108 |
env: |
ba2415
|
109 |
NODE_OPTIONS: '--max_old_space_size=4096' |
8ccf77
|
110 |
run: | |
f810a0
|
111 |
pnpm install --no-frozen-lockfile |
c46b04
|
112 |
pnpm build |
c6f9b0
|
113 |
touch dist/.nojekyll |
V |
114 |
cp dist/index.html dist/404.html |
c303ec
|
115 |
|
057b82
|
116 |
- name: Delete gh-pages branch |
J |
117 |
run: | |
|
118 |
git push origin --delete gh-pages |
|
119 |
|
c303ec
|
120 |
- name: Deploy |
e7ac09
|
121 |
uses: peaceiris/actions-gh-pages@v3.9.0 |
c5713c
|
122 |
with: |
e7ac09
|
123 |
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} |
c303ec
|
124 |
PUBLISH_BRANCH: gh-pages |
448d21
|
125 |
PUBLISH_DIR: ./dist |
e74a9e
|
126 |
CNAME: vben.vvbin.cn |