|
23 | 23 | - name: Build with Maven |
24 | 24 | run: mvn clean install -f NMSReportingSuite/pom.xml |
25 | 25 |
|
26 | | - # Step 4: Shutdown Tomcat if it is started |
27 | | - - name: Shutdown Tomcat if it is up |
28 | | - uses: appleboy/ssh-action@v0.1.6 |
29 | | - with: |
30 | | - host: ${{ secrets.STAGING_HOST }} |
31 | | - username: ${{ secrets.STAGING_USER }} |
32 | | - password: ${{ secrets.STAGING_PASSWORD }} |
33 | | - script: | |
34 | | - if pgrep -f "org.apache.catalina.startup.Bootstrap" > /dev/null; then |
35 | | - echo "Tomcat is running. Shutting it down..." |
36 | | - sh /usr/local/tomcat/apache-tomcat-7.0.108/bin/shutdown.sh |
37 | | - else |
38 | | - echo "Tomcat is not running." |
39 | | - fi |
40 | | -
|
41 | | - # Step 5: Deploy to Staging Server |
42 | | - - name: Deploy to Staging |
43 | | - uses: appleboy/scp-action@v0.1.4 |
44 | | - with: |
45 | | - host: ${{ secrets.STAGING_HOST }} |
46 | | - username: ${{ secrets.STAGING_USER }} |
47 | | - password: ${{ secrets.STAGING_PASSWORD }} |
48 | | - source: "NMSReportingSuite/target/*.war" |
49 | | - target: /usr/local/tomcat/apache-tomcat-7.0.108/webapps |
50 | | - |
51 | | - # Step 6: Restart Application (if needed) |
52 | | - - name: Restart Tomcat |
53 | | - uses: appleboy/ssh-action@v0.1.6 |
54 | | - with: |
55 | | - host: ${{ secrets.STAGING_HOST }} |
56 | | - username: ${{ secrets.STAGING_USER }} |
57 | | - password: ${{ secrets.STAGING_PASSWORD }} |
58 | | - script: | |
59 | | - if ! pgrep -f "org.apache.catalina.startup.Bootstrap" > /dev/null; then |
60 | | - echo "Tomcat is not running. Starting it up..." |
61 | | - sh /usr/local/tomcat/apache-tomcat-7.0.108/bin/startup.sh |
62 | | - else |
63 | | - echo "Tomcat is already running." |
64 | | - fi |
0 commit comments