-
Notifications
You must be signed in to change notification settings - Fork 7
33 lines (28 loc) · 1.05 KB
/
deploy-to-dev.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
name: Deploy to Dev Server
on:
push:
branches:
- jh-dev
paths-ignore:
- '**.github/workflows/**' # Ignore changes to workflow files
if: "contains(github.event.head_commit.message, '[deploy to dev]')" # Adjust trigger condition as needed
jobs:
deploy-to-dev-server:
if: "contains(github.event.head_commit.message, '[deploy to dev]')"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to Dev Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEV_SERVER_HOST }}
username: ${{ secrets.DEV_SERVER_USERNAME }}
key: ${{ secrets.DEV_SERVER_SSH_PRIVATE_KEY }}
- name: Copy deploy.sh to Dev Server
run: |
scp deploy.sh ${{ secrets.DEV_SERVER_USERNAME }}@${{ secrets.DEV_SERVER_HOST }}:~/deploy.sh
- name: Execute deploy.sh on Dev Server
run: |
ssh ${{ secrets.DEV_SERVER_USERNAME }}@${{ secrets.DEV_SERVER_HOST }} \
"chmod +x ~/deploy.sh && ~/deploy.sh"