No issue: Try deploying Maven artifacts #1496
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: Java CI with Maven | |
on: | |
push: | |
branches: [ "main", "release/**" ] | |
pull_request: | |
branches: [ "main", "release/**" ] | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
jdk: [17] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref || github.ref }} | |
- name: Set up JDK ${{ matrix.jdk }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.jdk }} | |
distribution: 'temurin' | |
cache: maven | |
server-id: ukp-oss | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
- name: Set up Maven | |
uses: stCarolas/setup-maven@v5 | |
with: | |
maven-version: 3.9.9 | |
- name: Set up cache date | |
run: echo "CACHE_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Cache Maven repository | |
id: maven-cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ env.CACHE_DATE }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build with Maven | |
if: "!(matrix.os == 'ubuntu-latest' && github.event_name != 'pull_request')" | |
run: mvn --show-version --batch-mode --no-transfer-progress clean deploy | |
- name: Build with Maven and publish artifacts | |
if: matrix.os == 'ubuntu-latest' && github.event_name != 'pull_request' | |
env: | |
# `MAVEN_USERNAME` and `MAVEN_PASSWORD` are used in `~/.m2/settings.xml` created by `setup-java` action | |
MAVEN_USERNAME: ${{ secrets.UKP_MAVEN_USER }} | |
MAVEN_PASSWORD: ${{ secrets.UKP_MAVEN_TOKEN }} | |
run: mvn --show-version --batch-mode --errors --no-transfer-progress -DdeployAtEnd=true -DskipTests clean deploy | |
- name: Capture build artifacts | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts | |
path: inception/inception-app-webapp/target/inception-app-webapp-*-standalone.jar | |