Skip to content

Issue1 maven central #10

Issue1 maven central

Issue1 maven central #10

Workflow file for this run

name: spring security acl mongodb CI
on:
push:
pull_request:
jobs:
buildDeploy:
name: Build-Deploy
runs-on: ubuntu-latest
env:
JDK_VERSION: 17
steps:
- uses: actions/checkout@v2
# (1) -> Prepare cache and Java
- name: Cache ~/.m2
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-${{ env.JDK_FILE }}-maven-${{ hashFiles('**/pom.xml') }}
# (2) -> Prepare Java
- name: Setup Java
uses: actions/setup-java@v1
with:
version: ${{ env.JDK_VERSION }}
- name: Verify Maven and Java
run: |
mvn --version
# (3) -> Test and build
- name: Run tests
run: |
mvn --quiet test
- name: Build package
run: |
mvn --quiet -B --fail-fast -DskipTests package
# (3) -> Deploy on Nexus
- name: Deploy (branch)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/') && !contains(github.ref, 'release')
run: |
GITHUB_BRANCH=`echo $GITHUB_REF | cut -d/ -f3- | sed 's#/#-#g'`
cp .nexus.settings.xml ~/.m2/settings.xml
mvn -B deploy -DskipTests -Dchangelist=.$GITHUB_BRANCH
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
- name: Deploy (release)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: |
GITHUB_TAG=`echo $GITHUB_REF | cut -d/ -f3`
# Release vX.Y.Z
if [[ $GITHUB_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
cp .nexus.settings.xml ~/.m2/settings.xml
mvn -B deploy -DskipTests -Dchangelist=.RELEASE
fi
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}