Bump actions/setup-java from 4.0.0 to 4.2.0 (#127) #229
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |