Skip to content

snapshot

snapshot #4

Workflow file for this run

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: Import GPG key
run: |
echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Build and Deploy with Maven
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
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