-
Notifications
You must be signed in to change notification settings - Fork 3
57 lines (52 loc) · 2.13 KB
/
maven-pr.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
name: Java CI with Maven (PR)
on:
pull_request:
types: [ opened, synchronize, ready_for_review, review_requested, labeled ]
concurrency: pr-${{ github.event.pull_request.id }}
jobs:
check-version:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'release')
steps:
- uses: actions/checkout@v3
- name: Check if version is updated
uses: avides/[email protected]
id: actions_project_version_check
with:
token: ${{ secrets.GITHUB_TOKEN }}
file-to-check: pom.xml
continue-on-error: true
- name: Versioning specifications
if: steps.actions_project_version_check.outcome != 'success'
uses: thollander/actions-comment-pull-request@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: Project version has not been updated in pom.xml. Please, update your version using https://semver.org specifications.
- name: Exit if fails
if: steps.actions_project_version_check.outcome != 'success'
uses: cutenode/action-always-fail@v1
- name: New software version
if: steps.actions_project_version_check.outcome == 'success'
run: echo "New software version is " ${{ steps.actions_project_version_check.outputs.version }}
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: "17"
distribution: "adopt"
- name: Build with Maven
run: mvn -B package --file pom.xml
check-labels:
runs-on: ubuntu-latest
if: github.event.pull_request.mergeable == true
steps:
- name: Warn about missing labels
if: ${{ !contains(github.event.pull_request.labels.*.name, 'release') && !contains(github.event.pull_request.labels.*.name, 'documentation') }}
uses: thollander/actions-comment-pull-request@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: "This pull request hasn't been labeled as `release` nor `documentation`. Please ensure this is intentional before merging."
comment_tag: label-warn