-
Notifications
You must be signed in to change notification settings - Fork 4
88 lines (75 loc) · 2.49 KB
/
gradle-push.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
87
88
name: Gradle Build
on:
push:
branches:
- master
- release/**
- feature/**
- bugfix/**
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
build:
env:
TERM: dumb
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 8
distribution: adopt
- uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradlew-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradlew-
- name: Compile and check with Gradle
run: ./gradlew check jacocoTestReport
- name: Publish Test Report
if: failure()
uses: scacap/action-surefire-report@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
report_paths: '**/build/test-results/*/TEST-*.xml'
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
JAVA_HOME: ""
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectKey=jmongard_Git.SemVersioning.Gradle
-Dsonar.organization=jmongard
-Dsonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml
-Dsonar.tests=src/test,src/functionalTest
-Dsonar.sources=src/main
- name: Build with Gradle
run: ./gradlew build
- run: git status
- name: Publish gradle plugin
if: startsWith(github.ref, 'refs/tags/v')
run: |
echo "gradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }}" > ~/.gradle/gradle.properties
echo "gradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }}" >> ~/.gradle/gradle.properties
./gradlew publishPlugins
- name: Create GitHub release
if: "startsWith(github.ref, 'refs/tags/')"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag=$(git describe --tags --abbrev=0)
version=$(./gradlew -q printVersion)
./gradlew -q printChangeLog | gh release create $tag -t "Git Semver Plugin $version" -F -