Skip to content

Commit 09cb916

Browse files
committed
corrected indetation.
1 parent 5277275 commit 09cb916

File tree

1 file changed

+59
-62
lines changed

1 file changed

+59
-62
lines changed
Lines changed: 59 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,63 @@
11
name: Build and Deploy to Staging
2-
32
on:
4-
push:
5-
branches:
6-
- deployment
3+
push:
4+
branches:
5+
- deployment
76

87
jobs:
9-
build-and-deploy:
10-
runs-on: ubuntu-latest
11-
12-
steps:
13-
# Step 1: Check out the code
14-
- name: Checkout Code
15-
uses: actions/checkout@v3
16-
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
22-
23-
# Step 3: Build the JAR
24-
- name: Build with Maven
25-
run: mvn clean install
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
41-
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
66-
8+
build-and-deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
# Step 1: Check out the code
12+
- name: Checkout repository
13+
uses: actions/checkout@v3
14+
15+
# Step 2: Set up Java
16+
- name: Set up JDK
17+
uses: actions/setup-java@v3
18+
with:
19+
java-version: '8'
20+
21+
# Step 3: Build the JAR
22+
- name: Build with Maven
23+
run: mvn clean install
24+
25+
# Step 4: Shutdown Tomcat if it is started
26+
- name: Shutdown Tomcat if it is up
27+
uses: appleboy/ssh-action@v0.1.6
28+
with:
29+
host: ${{ secrets.STAGING_HOST }}
30+
username: ${{ secrets.STAGING_USER }}
31+
key: ${{ secrets.STAGING_KEY }}
32+
script: |
33+
if pgrep -f "org.apache.catalina.startup.Bootstrap" > /dev/null; then
34+
echo "Tomcat is running. Shutting it down..."
35+
sh /usr/local/tomcat/apache-tomcat-7.0.108/bin/shutdown.sh
36+
else
37+
echo "Tomcat is not running."
38+
fi
39+
40+
# Step 5: Deploy to Staging Server
41+
- name: Deploy to Staging
42+
uses: appleboy/scp-action@v0.1.4
43+
with:
44+
host: ${{ secrets.STAGING_HOST }}
45+
username: ${{ secrets.STAGING_USER }}
46+
key: ${{ secrets.STAGING_KEY }}
47+
source: "NMSReportingSuite/target/*.war"
48+
target: /usr/local/tomcat/apache-tomcat-7.0.108/webapps
49+
50+
# Step 6: Restart Application (if needed)
51+
- name: Restart Tomcat
52+
uses: appleboy/ssh-action@v0.1.6
53+
with:
54+
host: ${{ secrets.STAGING_HOST }}
55+
username: ${{ secrets.STAGING_USER }}
56+
key: ${{ secrets.STAGING_KEY }}
57+
script: |
58+
if ! pgrep -f "org.apache.catalina.startup.Bootstrap" > /dev/null; then
59+
echo "Tomcat is not running. Starting it up..."
60+
sh /usr/local/tomcat/apache-tomcat-7.0.108/bin/startup.sh
61+
else
62+
echo "Tomcat is already running."
63+
fi

0 commit comments

Comments
 (0)