Merge pull request #10 from 1and1/dependabot/maven/io.gsonfire-gson-f… #114
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: Extract, generate and build OpenAPI code | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
extract-openapi: | |
uses: 1and1/checkmk-java-client/.github/workflows/extract-openapi.yaml@main | |
with: | |
cmk_version: 2.2.0p12 | |
target_artifact: openapi | |
build: | |
name: Build Checkmk REST-API | |
needs: | |
- extract-openapi | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [ '8', '11', '17', '21' ] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK | |
uses: actions/setup-java@v2 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'temurin' | |
cache: maven | |
- name: Download OpenAPI spec from above job | |
uses: actions/download-artifact@v3 | |
with: | |
name: openapi | |
- name: Cache local Maven repository | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build with Maven | |
run: mvn -B package --no-transfer-progress --file pom.xml | |
env: | |
JAVA_POST_PROCESS_FILE: ./java_post_process_file.sh | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: jars | |
path: | | |
target/*.jar | |
deploy-snapshot: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'adopt' | |
- name: Download OpenAPI spec from above job | |
uses: actions/download-artifact@v3 | |
with: | |
name: openapi | |
- name: Cache local Maven repository | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Deploy with Maven to SONATYPE OSS Snapshot if secrets are set | |
env: | |
SONATYPE_USER: ${{ secrets.SONATYPE_USER }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
JAVA_POST_PROCESS_FILE: ./java_post_process_file.sh | |
run: | | |
if [ "${SONATYPE_USER}" != "" -a "${SONATYPE_PASSWORD}" != "" ]; then | |
mvn -B deploy -P sonatype-oss-snapshot -s .github/settings.xml | |
else | |
echo "Not deploying, secrets SONATYPE_USER and SONATYPE_PASSWORD not provided" | |
fi |