-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (72 loc) · 2.93 KB
/
master_payments-mg.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy JAR app to Azure Web App - payments-mg
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
environment:
name: build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Java version
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache the Maven packages to speed up build
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Analyze with SonarCloud
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SPRING_DATASOURCE_URL: ${{ secrets.SPRING_DATASOURCE_URL }}
SPRING_DATASOURCE_USERNAME: ${{ secrets.SPRING_DATASOURCE_USERNAME }}
SPRING_DATASOURCE_PASSWORD: ${{ secrets.SPRING_DATASOURCE_PASSWORD }}
SPRING_SUPPORT_EMAIL: ${{ secrets.SPRING_SUPPORT_EMAIL }}
SPRING_MAIL_USERNAME: ${{ secrets.SPRING_MAIL_USERNAME }}
SPRING_MAIL_PASSWORD: ${{ secrets.SPRING_MAIL_PASSWORD }}
run: mvn -P tomcat org.jacoco:jacoco-maven-plugin:prepare-agent test org.jacoco:jacoco-maven-plugin:report verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} -Dsonar.host.url=https://sonarcloud.io -Dsonar.java.coveragePlugin=jacoco -Dsonar.jacoco.reportPaths='${{ github.workspace }}/target/jacoco.exec' -Dsonar.coverage.jacoco.xmlReportPaths='${{ github.workspace }}/target/site/jacoco/jacoco.xml' -Dsonar.verbose=true
- name: Build with Maven
run: mvn -P tomcat clean package -DskipTests
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: package
path: '${{ github.workspace }}/target/*.war'
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: release
steps:
- name: Download a Build Artifact
uses: actions/download-artifact@v3
with:
name: package
path: '${{ github.workspace }}/target'
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: 'payments-mg'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_27fdeef5e453441f8746fbf0c59e9692 }}
package: '${{ github.workspace }}/target/*.war'