|
1 | | -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time |
2 | | -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven |
3 | | - |
4 | | -# This workflow uses actions that are not certified by GitHub. |
5 | | -# They are provided by a third-party and are governed by |
6 | | -# separate terms of service, privacy policy, and support |
7 | | -# documentation. |
8 | | - |
9 | | -name: Java CI with Maven |
| 1 | +name: Maven Build CI/CD Pipeline |
10 | 2 |
|
11 | 3 | on: |
12 | 4 | push: |
13 | | - branches: [ "master" ] |
| 5 | + branches: [ "master", "develop" ] |
14 | 6 | pull_request: |
15 | 7 | branches: [ "master" ] |
16 | | - workflow_dispatch: |
17 | 8 |
|
18 | | -env: |
19 | | - mavenGoal: "clean install" |
20 | 9 | jobs: |
21 | 10 | build: |
22 | | - runs-on: ubuntu-latest |
23 | | - env: |
24 | | - buildScript: "pom.xml" |
25 | | - steps: |
26 | | - - uses: actions/checkout@v3 |
27 | | - - name: Set up JDK 17 |
28 | | - uses: actions/setup-java@v3 |
29 | | - with: |
30 | | - java-version: '17' |
31 | | - distribution: 'temurin' |
32 | | - cache: maven |
33 | | - - name: Build with Maven |
34 | | - run: "mvn -B ${mavenGoal} --file ${buildScript}" |
35 | | - - name: SonarQube Scan |
36 | | - uses: sonarsource/sonarqube-scan-action@master |
37 | | - env: |
38 | | - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
39 | | - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} |
40 | | - - uses: actions/upload-artifact@v3 |
41 | | - with: |
42 | | - name: buildArtifact |
43 | | - path: target/*.war |
44 | | - |
45 | | - deploy: |
46 | | - needs: build |
47 | | - runs-on: ubuntu-latest |
48 | | - steps: |
49 | | - - uses: actions/download-artifact@v3 |
50 | | - with: |
51 | | - name: buildArtifact |
52 | | - - name: Production Deployment |
53 | | - run: | |
54 | | - ls -lart |
55 | | - - name: scp ssh pipelines |
56 | | - uses: cross-the-world/ssh-scp-ssh-pipelines@latest |
57 | | - env: |
58 | | - LASTSSH: "Doing something after copying" |
59 | | - with: |
60 | | - host: ${{ secrets.DC_HOST }} |
61 | | - user: ${{ secrets.DC_USER }} |
62 | | - pass: ${{ secrets.DC_KEY }} |
63 | | - scp: | |
64 | | - ./*.war => /tmp/ |
65 | | - last_ssh: | |
66 | | - sudo cp /tmp/*.war /var/lib/tomcat9/webapps/Anuj.war |
67 | | - ls -la |
| 11 | + uses: anujdevopslearn/GithubActionsWorkflows/.github/workflows/maven.yml@main |
0 commit comments