Skip to content

49 increment coverage for testing PR (#51) #34

49 increment coverage for testing PR (#51)

49 increment coverage for testing PR (#51) #34

name: Java CI with Maven (Push)
on:
push:
branches: [main]
jobs:
check-pr-labels:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
labels: ${{ steps.get-pr.outputs.pr_labels }}
steps:
- name: Get Pull Request information
uses: 8BitJonny/[email protected]
id: get-pr
check-version:
runs-on: ubuntu-latest
needs: [check-pr-labels]
if: ${{ contains(needs.check-pr-labels.outputs.labels, 'release') }}
steps:
- uses: actions/checkout@v3
- name: Check if version is updated
uses: avides/[email protected]
id: engine_version_check
with:
token: ${{ secrets.GITHUB_TOKEN }}
file-to-check: pom.xml
continue-on-error: true
build:
runs-on: ubuntu-latest
needs: [check-version, check-pr-labels]
if: contains(needs.check-version.result, 'success')
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: "17"
distribution: "adopt"
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Publish Maven Plugin to Maven Central Packages
# Uses production profile to sign with gpg plugin
run: |
mvn -B install
mvn -B deploy -P production
env:
MAVEN_USERNAME: ${{ secrets.JIRAID }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.JIRAPASS }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
SIGN_KEY: ${{ secrets.JIRAID }}
SIGN_KEY_ID: ${{ secrets.JIRAPASS }}
SIGN_KEY_PASS: ${{ secrets.GPG_PASSPHRASE }}
- name: Maven version
id: get-version
run: |
echo "version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" | tee $GITHUB_OUTPUT
- name: Create a Release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: ${{ steps.get-version.outputs.version }}
prerelease: false
title: "Maven Release ${{ steps.get-version.outputs.version }}"