Skip to content

Commit 5277275

Browse files
committed
change branch name deployment
1 parent f29735c commit 5277275

File tree

1 file changed

+55
-55
lines changed

1 file changed

+55
-55
lines changed
Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,66 @@
11
name: Build and Deploy to Staging
22

33
on:
4-
push:
5-
branches:
6-
- sms-properties-changes
4+
push:
5+
branches:
6+
- deployment
77

88
jobs:
9-
build-and-deploy:
10-
runs-on: ubuntu-latest
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
1111

12-
steps:
13-
# Step 1: Check out the code
14-
- name: Checkout Code
15-
uses: actions/checkout@v3
12+
steps:
13+
# Step 1: Check out the code
14+
- name: Checkout Code
15+
uses: actions/checkout@v3
1616

17-
# Step 2: Set up Java
18-
- name: Set up JDK
19-
uses: actions/setup-java@v3
20-
with:
21-
java-version: '8' # Specify your Java version
17+
# Step 2: Set up Java
18+
- name: Set up JDK
19+
uses: actions/setup-java@v3
20+
with:
21+
java-version: '8' # Specify your Java version
2222

23-
# Step 3: Build the JAR
24-
- name: Build with Maven
25-
run: mvn clean intsall
26-
27-
# Step 4 : shutdown tomcat if it is started
28-
- name: Shutdown Tomcat if it is up
29-
uses: appleboy/ssh-action@v0.1.6
30-
with:
31-
host: ${{ secrets.STAGING_HOST }}
32-
username: ${{ secrets.STAGING_USER }}
33-
key: ${{ secrets.STAGING_KEY }}
34-
script: |
35-
if pgrep -f "org.apache.catalina.startup.Bootstrap" > /dev/null; then
36-
echo "Tomcat is running. Shutting it down..."
37-
sh /usr/local/tomcat/apache-tomcat-7.0.108/bin/shutdown.sh
38-
else
39-
echo "Tomcat is not running."
40-
fi
23+
# Step 3: Build the JAR
24+
- name: Build with Maven
25+
run: mvn clean install
4126

42-
# Step 5: Deploy to Staging Server
43-
- name: Deploy to Staging
44-
uses: appleboy/scp-action@v0.1.4
45-
with:
46-
host: ${{ secrets.STAGING_HOST }}
47-
username: ${{ secrets.STAGING_USER }}
48-
key: ${{ secrets.STAGING_KEY }}
49-
source: "NMSReportingSuite/target/*.war"
50-
target: /usr/local/tomcat/apache-tomcat-7.0.108/webapps
27+
# Step 4: Shutdown Tomcat if it is started
28+
- name: Shutdown Tomcat if it is up
29+
uses: appleboy/ssh-action@v0.1.6
30+
with:
31+
host: ${{ secrets.STAGING_HOST }}
32+
username: ${{ secrets.STAGING_USER }}
33+
key: ${{ secrets.STAGING_KEY }}
34+
script: |
35+
if pgrep -f "org.apache.catalina.startup.Bootstrap" > /dev/null; then
36+
echo "Tomcat is running. Shutting it down..."
37+
sh /usr/local/tomcat/apache-tomcat-7.0.108/bin/shutdown.sh
38+
else
39+
echo "Tomcat is not running."
40+
fi
5141

52-
# Step 6: Restart Application (if needed)
53-
- name: Restart tomcat
54-
uses: appleboy/ssh-action@v0.1.6
55-
with:
56-
host: ${{ secrets.STAGING_HOST }}
57-
username: ${{ secrets.STAGING_USER }}
58-
key: ${{ secrets.STAGING_KEY }}
59-
script: |
60-
if ! pgrep -f "org.apache.catalina.startup.Bootstrap" > /dev/null; then
61-
echo "Tomcat is not running. Starting it up..."
62-
sh /usr/local/tomcat/apache-tomcat-7.0.108/bin/startup.sh
63-
else
64-
echo "Tomcat is already running."
65-
fi
42+
# Step 5: Deploy to Staging Server
43+
- name: Deploy to Staging
44+
uses: appleboy/scp-action@v0.1.4
45+
with:
46+
host: ${{ secrets.STAGING_HOST }}
47+
username: ${{ secrets.STAGING_USER }}
48+
key: ${{ secrets.STAGING_KEY }}
49+
source: "NMSReportingSuite/target/*.war"
50+
target: /usr/local/tomcat/apache-tomcat-7.0.108/webapps
51+
52+
# Step 6: Restart Application (if needed)
53+
- name: Restart Tomcat
54+
uses: appleboy/ssh-action@v0.1.6
55+
with:
56+
host: ${{ secrets.STAGING_HOST }}
57+
username: ${{ secrets.STAGING_USER }}
58+
key: ${{ secrets.STAGING_KEY }}
59+
script: |
60+
if ! pgrep -f "org.apache.catalina.startup.Bootstrap" > /dev/null; then
61+
echo "Tomcat is not running. Starting it up..."
62+
sh /usr/local/tomcat/apache-tomcat-7.0.108/bin/startup.sh
63+
else
64+
echo "Tomcat is already running."
65+
fi
6666

0 commit comments

Comments
 (0)