ABDAN HAFIDZ commited on
Create deploy-development.yml
Browse files
.github/workflows/deploy-development.yml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Deploy to Development
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- dev
|
| 7 |
+
|
| 8 |
+
jobs:
|
| 9 |
+
deploy:
|
| 10 |
+
runs-on: ubuntu-latest
|
| 11 |
+
|
| 12 |
+
steps:
|
| 13 |
+
- name: Checkout Repository
|
| 14 |
+
uses: actions/checkout@v4
|
| 15 |
+
with:
|
| 16 |
+
fetch-depth: 0
|
| 17 |
+
|
| 18 |
+
- name: Setup SSH Agent
|
| 19 |
+
uses: webfactory/ssh-agent@v0.9.0
|
| 20 |
+
with:
|
| 21 |
+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
| 22 |
+
|
| 23 |
+
- name: Configure SSH
|
| 24 |
+
run: |
|
| 25 |
+
mkdir -p ~/.ssh
|
| 26 |
+
chmod 700 ~/.ssh
|
| 27 |
+
|
| 28 |
+
ssh-keyscan -4 -p 10022 -H ${{ secrets.VPS_HOST }} >> ~/.ssh/known_hosts
|
| 29 |
+
|
| 30 |
+
chmod 644 ~/.ssh/known_hosts
|
| 31 |
+
|
| 32 |
+
- name: Test SSH Connection
|
| 33 |
+
run: |
|
| 34 |
+
ssh -p 10022 -o StrictHostKeyChecking=no capstone4@${{ secrets.VPS_HOST }} "echo SSH CONNECTED"
|
| 35 |
+
|
| 36 |
+
- name: Push to VPS
|
| 37 |
+
run: |
|
| 38 |
+
git remote remove vps || true
|
| 39 |
+
|
| 40 |
+
git remote add vps ssh://capstone4@${{ secrets.VPS_HOST }}:10022/home/capstone4/git/repos/frontend-development.git
|
| 41 |
+
|
| 42 |
+
git push vps HEAD:development --force
|