Skip to content

Commit 5c6a22c

Browse files
committed
feat: add deploy on test - improve
1 parent c8983cf commit 5c6a22c

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

.github/workflows/deploy.yml

+13-10
Original file line numberDiff line numberDiff line change
@@ -49,33 +49,35 @@ jobs:
4949
exit 1
5050
fi
5151
52-
# Configuration of SSH
52+
# Configure SSH for access
5353
mkdir -p ~/.ssh
5454
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | tee ~/.ssh/id_rsa > /dev/null
5555
chmod 600 ~/.ssh/id_rsa
5656
ssh-keyscan -H "$SERVER_IP" >> ~/.ssh/known_hosts
5757
58-
# Test SSH
58+
# Test SSH connection
5959
ssh -o StrictHostKeyChecking=no "$SERVER_USER@$SERVER_IP" "echo 'SSH connection successful'"
60-
60+
61+
# Deploy to the test server
6162
rsync -avz --chown=$SERVER_USER:www-data --chmod=775 --delete dist/ "$SERVER_USER@$SERVER_IP:$SERVER_PATH"
63+
6264
test:
6365
runs-on: ubuntu-latest
64-
needs: build
66+
needs: deploy-on-test
6567
steps:
6668
- name: Checkout Selenium Tests Repository
6769
run: |
6870
git clone https://github.com/coundia/selenium-java-pcoundia.git selenium-tests
6971
7072
- name: Run Selenium Tests
7173
env:
72-
SERVER_URL: "https://pcoundia.com"
74+
SERVER_URL: "https://test.pcoundia.com" # Point to your test server URL
7375
run: |
7476
cd selenium-tests
7577
mvn clean test -Dapp.url=$SERVER_URL
7678
7779
deploy-on-prod:
78-
needs: build
80+
needs: test
7981
runs-on: ubuntu-latest
8082
steps:
8183
- name: Download build artifacts
@@ -97,13 +99,14 @@ jobs:
9799
exit 1
98100
fi
99101
100-
# Configuration of SSH
102+
# Configure SSH for access
101103
mkdir -p ~/.ssh
102104
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | tee ~/.ssh/id_rsa > /dev/null
103105
chmod 600 ~/.ssh/id_rsa
104106
ssh-keyscan -H "$SERVER_IP" >> ~/.ssh/known_hosts
105107
106-
# Test SSH
108+
# Test SSH connection
107109
ssh -o StrictHostKeyChecking=no "$SERVER_USER@$SERVER_IP" "echo 'SSH connection successful'"
108-
109-
rsync -avz --chown=$SERVER_USER:www-data --chmod=775 --delete dist/ "$SERVER_USER@$SERVER_IP:$SERVER_PATH"
110+
111+
# Deploy to the production server
112+
rsync -avz --chown=$SERVER_USER:www-data --chmod=775 --delete dist/ "$SERVER_USER@$SERVER_IP:$SERVER_PATH"

0 commit comments

Comments
 (0)