Update pom.xml #163
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') || contains(needs.check-pr-labels.outputs.labels, 'maven') }} | |
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: multiapi-engine/pom.xml | |
continue-on-error: true | |
- name: Check if version is updated | |
uses: avides/actions-project-version-check@v1.3 | |
id: maven_plugin_version_check | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
file-to-check: scs-multiapi-maven-plugin/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 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: "11" | |
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: Build Engine Plugin | |
run: | | |
cd multiapi-engine | |
mvn -B install | |
- name: Publish Maven Plugin to Maven Central Packages | |
# Uses production profile to sign with gpg plugin | |
run: | | |
cd scs-multiapi-maven-plugin | |
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 }} | |
TOKEN_USER_NAME: ${{ secrets.TOKEN_USER_NAME }} | |
TOKEN_PASSWORD: ${{ secrets.TOKEN_PASSWORD }} | |
- name: Maven version | |
id: get-version | |
run: | | |
cd scs-multiapi-maven-plugin | |
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 }}" |