-
Notifications
You must be signed in to change notification settings - Fork 87
86 lines (76 loc) · 3.46 KB
/
maven.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
85
86
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Build, test and analyze
on:
push:
branches: [ develop, master ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11.0.7
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file: :
- name: 'Create settings.xml'
uses: whelk-io/maven-settings-xml-action@v4
with:
servers: '[{"id": "github", "username": "${{ github.actor }}", "password": "${{ github.token}}"}, {"id": "github-annotation", "username": "${{ github.actor }}", "password": "${{ github.token }}"}]'
repositories: '[{"id" : "github", "url" : "https://maven.pkg.github.com/Ubique-OSS/springboot-swagger3"}, {"id" : "github-annotation", "url" : "https://maven.pkg.github.com/Ubique-OSS/springboot-swagger3-annotations"}]'
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Cache SonarCloud packages
uses: actions/cache@v2
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build and run tests
run: |
mvn clean install --file dpppt-backend-sdk/pom.xml;
mvn springboot-swagger-3:springboot-swagger-3 -f dpppt-backend-sdk/dpppt-backend-sdk-ws/pom.xml
env:
GITHUB_TOKEN: ${{ github.token }}
TESTCONTAINERS_RYUK_DISABLED: true
- name: Analyze (sonar)
run: mvn sonar:sonar --file dpppt-backend-sdk/dpppt-backend-sdk-ws/pom.xml
env:
SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_PULL_REQUEST_KEY: ${{ github.event.number }}
TESTCONTAINERS_RYUK_DISABLED: true
- name: Publish to GitHub Packages Apache Maven
if: github.ref == 'refs/heads/develop'
run: mvn deploy -Dmaven.test.skip=true --file dpppt-backend-sdk/pom.xml -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}
- name: shasum
run: shasum -a 256 dpppt-backend-sdk/dpppt-backend-sdk-ws/target/dpppt-backend-sdk-ws.jar > dpppt-backend-sdk/dpppt-backend-sdk-ws/target/dpppt-backend-sdk-ws.sha256
shell: bash
- name: Create Snapshot Release
uses: ncipollo/release-action@v1
if: github.ref == 'refs/heads/develop'
id: create_release
with:
name: Snapshot Release ${{ github.ref }}
tag: SNAPSHOT
artifacts: "dpppt-backend-sdk/dpppt-backend-sdk-ws/target/dpppt-backend-sdk-ws.jar,dpppt-backend-sdk/dpppt-backend-sdk-ws/target/dpppt-backend-sdk-ws.sha256,dpppt-backend-sdk/dpppt-backend-sdk-ws/generated/swagger/swagger.yaml"
body: |
Changes in this Release
- Snapshot release
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false
allowUpdates: true