Files
file-online-preview/.github/workflows/maven.yml
addwes7 3e16ed9d3b Add Windows and macOS to CI build matrix and fix cross-platform issues (#768)
* Add Windows and macOS to CI build matrix and fix cross-platform issues

* run nightly e2e on ubuntu and prevent duplicate artifact upload
2026-06-26 11:38:15 +08:00

56 lines
1.5 KiB
Java

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin' # 使用 Eclipse Temurin (AdoptOpenJDK 的继任者)
cache: 'maven'
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn -B package "-Dmaven.test.skip=true" --file pom.xml
- name: Upload Linux distribution package
if: success() && runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: kkfileview-linux
path: server/target/*.tar.gz
retention-days: 7
- name: Upload Windows distribution package
if: success() && runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: kkfileview-windows
path: server/target/*.zip
retention-days: 7
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]