Skip to content

Commit 3296050

Browse files
authored
update deployment
1 parent 70f4b93 commit 3296050

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/static.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,30 @@ jobs:
4141
- name: Deploy to GitHub Pages
4242
id: deployment
4343
uses: actions/deploy-pages@v4
44+
45+
deploy-on-ali:
46+
runs-on: ubuntu-latest
47+
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@v4
51+
52+
- name: Setup SSH
53+
run: |
54+
mkdir -p ~/.ssh
55+
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/server_key.pem
56+
chmod 600 ~/.ssh/server_key.pem
57+
ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
58+
59+
- name: Deploy via rsync
60+
run: |
61+
rsync -avz --delete \
62+
-e "ssh -i ~/.ssh/server_key.pem -o StrictHostKeyChecking=no" \
63+
./ \
64+
${{ secrets.SSH_USERNAME }}@${{ secrets.SERVER_IP }}:/var/www/html/
65+
66+
- name: Reload web server
67+
run: |
68+
ssh -i ~/.ssh/server_key.pem \
69+
${{ secrets.SSH_USERNAME }}@${{ secrets.SERVER_IP }} \
70+
"systemctl reload nginx"

0 commit comments

Comments
 (0)