49 increment coverage for testing PR (#51) #34
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 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/gh-get-current-pr@2.2.0 | |
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/actions-project-version-check@v1.3 | |
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 }}" |