Java 8 CI with Maven #844
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
# This workflow will build a Java project with Maven | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: Java 8 CI with Maven | |
on: | |
push: | |
branches: [ develop, 3.1.x, 3.0.x ] | |
pull_request: | |
branches: [ develop, 3.1.x, 3.0.x ] | |
workflow_dispatch: | |
schedule: | |
- cron: 0 5 * * 1 | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 8 PR | |
if: github.event_name == 'pull_request' | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
# Step that does that actual cache save and restore | |
- name: Set up JDK 8 Branch | |
if: github.event_name != 'pull_request' | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
server-id: sonatype-nexus-snapshots | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
# Step that does that actual cache save and restore | |
- name: Cache | |
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 --file pom.xml | |
- name: Publish Snapshot | |
if: github.event_name != 'pull_request' | |
run: mvn -B clean deploy -DskipTests --file pom.xml | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} |