Skip to content

Commit b1d113d

Browse files
committed
ci: set server to deploy
1 parent 079dddc commit b1d113d

File tree

5 files changed

+35
-7
lines changed

5 files changed

+35
-7
lines changed

.github/workflows/pages.yaml .github/workflows/deploy.yaml

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pages
1+
name: Deploy
22

33
on:
44
push:
@@ -8,7 +8,7 @@ on:
88
branches:
99
- master # default branch
1010
jobs:
11-
pages:
11+
build:
1212
runs-on: ubuntu-latest
1313
permissions:
1414
contents: write
@@ -34,8 +34,17 @@ jobs:
3434
cd ../
3535
- name: Build
3636
run: npm run build
37+
- name: Setup SSH Private Key
38+
env:
39+
KEY: ${{ secrets.KEY }}
40+
run: |
41+
mkdir -p ~/.ssh/
42+
echo "$KEY" > ~/.ssh/id_rsa
43+
chmod 600 ~/.ssh/id_rsa
44+
ssh-keyscan 20.115.186.5 >> ~/.ssh/known_hosts
3745
- name: Deploy
38-
uses: peaceiris/actions-gh-pages@v3
39-
with:
40-
github_token: ${{ secrets.GITHUB_TOKEN }}
41-
publish_dir: ./website
46+
run: |
47+
sudo apt install expect -y
48+
cd ./deploy
49+
chmod +x deploy.sh unzipServer.sh upload.sh
50+
./deploy.sh

deploy/deploy.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
./upload.sh
4+
./unzipServer.sh

deploy/unzipServer.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
#!/usr/bin/expect
3+
4+
set timeout 10
5+
6+
expect "aosc@vmportal001:~$"
7+
send "cd /home/aosc/web\r"
8+
send "rm -rf website\r"
9+
send "unzip -x website.zip\r"
10+
expect eof

deploy/upload.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
rm -rf website*
4+
pnpm run build
5+
zip -r website.zip ../website/
6+
scp website.zip [email protected]:/home/aosc/web/

public/CNAME

-1
This file was deleted.

0 commit comments

Comments
 (0)