-
Notifications
You must be signed in to change notification settings - Fork 4
52 lines (46 loc) · 1.54 KB
/
build.yaml
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
name: Java CI Build
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set up JDK 17
uses: actions/setup-java@v4.2.0
with:
java-version: 17
distribution: zulu
# Determine next version to build. New version is in variable new_tag. Only for main branch as dependabot pull requests cannot create tags:
# https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/
- name: Determine new version
if: github.ref == 'refs/heads/main'
id: versioning
uses: anothrNick/github-tag-action@1.50.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_OWNER: kevinferrare
RELEASE_BRANCHES: main
INITIAL_VERSION: 1.0.0
DRY_RUN: false
# Sets the versions in the pom so that the generated artifacts are not -SNAPSHOT, build and publish
- name: Build Maven and deploy
if: github.ref == 'refs/heads/main'
env:
VERSION: ${{ steps.versioning.outputs.new_tag }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mvn -B versions:set -DnewVersion=${VERSION} &> /dev/null
mvn -B clean install
mvn -B deploy
# When on a branch, do not deploy since no tag has been created
- name: Build Maven without deploy
if: github.ref != 'refs/heads/main'
run: |
mvn -B clean verify