Skip to content

Commit

Permalink
ci: set server to deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
xunpod committed Jun 28, 2024
1 parent 079dddc commit fe17a57
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 7 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/pages.yaml → .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pages
name: Deploy

on:
push:
Expand All @@ -8,7 +8,7 @@ on:
branches:
- master # default branch
jobs:
pages:
build:
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -34,8 +34,17 @@ jobs:
cd ../
- name: Build
run: npm run build
- name: Setup SSH Private Key
env:
KEY: ${{ secrets.KEY }}
run: |
mkdir -p ~/.ssh/
echo "$KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan 20.115.186.5 >> ~/.ssh/known_hosts
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./website
run: |
sudo apt install expect tcl -y
cd ./deploy
chmod +x deploy.sh unzipServer.sh upload.sh
./deploy.sh
4 changes: 4 additions & 0 deletions deploy/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

./upload.sh
./unzipServer.sh
10 changes: 10 additions & 0 deletions deploy/unzipServer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

#!/usr/bin/expect

set timeout 10
spawn ssh [email protected]
expect "aosc@vmportal001:~$"
send "cd /home/aosc/web\r"
send "rm -rf website\r"
send "unzip -x website.zip\r"
expect eof
6 changes: 6 additions & 0 deletions deploy/upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

rm -rf website*
pnpm run build
zip -r website.zip ../website/
scp website.zip [email protected]:/home/aosc/web/
1 change: 0 additions & 1 deletion public/CNAME

This file was deleted.

0 comments on commit fe17a57

Please sign in to comment.