Merge pull request #162 from dbmdz/renovate/configure #74
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: CI | |
on: | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [11] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
check-latest: true | |
distribution: temurin | |
java-version: ${{ matrix.java }} | |
- uses: actions/cache@v3 | |
env: | |
cache-name: cache-maven-artifacts | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
- name: Start docker setup | |
run: docker-compose up -d | |
- name: Build with Maven | |
run: mvn -B verify | |
publish: | |
if: github.event_name == 'push' && contains(github.ref, 'main') | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
check-latest: true | |
distribution: temurin | |
java-version: 11 | |
server-id: ossrh-snapshots | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
- uses: actions/cache@v3 | |
env: | |
cache-name: cache-maven-artifacts | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
- name: Start docker setup | |
run: docker-compose up -d | |
- name: Install XML utils | |
run: sudo apt update && sudo apt install libxml2-utils | |
- name: Set project version | |
run: echo "PROJECT_VERSION=$(xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' pom.xml)" >> $GITHUB_ENV | |
- name: Publish to the Maven Central Repository | |
run: if [[ "$PROJECT_VERSION" =~ .*SNAPSHOT ]]; then mvn -B deploy; fi | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} |