release #41
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: Maven Build and Deploy | |
on: | |
push: | |
branches: | |
- master | |
- '**/v**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Cache Maven packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Extract version number | |
id: extract-version | |
run: | | |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Build and Deploy with Maven | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
GPG_TTY: /dev/tty # This is necessary to enable GPG in CI environments | |
run: | | |
if [[ "$VERSION" == *-SNAPSHOT ]]; then | |
echo "------- Maven Deploy snapshot on ${{ github.event_name }} -------"; | |
mvn -B -e -f pom.xml clean deploy --settings maven-settings.xml | |
else | |
echo "------- Maven Deploy release on ${{ github.event_name }} -------"; | |
mvn -B -e -f pom.xml clean deploy -DperformRelease=true --settings maven-settings.xml | |
fi | |