build_java

This commit is contained in:
smf
2024-03-02 19:48:13 +08:00
parent 9a1f411a34
commit be6c5ff6e7
2 changed files with 60 additions and 2 deletions

52
.github/workflows/build_java.yml vendored Normal file
View File

@@ -0,0 +1,52 @@
on:
workflow_call:
inputs:
maven-version:
required: true
type: string
java-version:
required: true
type: string
artifact-name:
required: true
type: string
jobs:
build_java_project:
runs-on: ubuntu_act_on_20
# container:
# image: catthehacker/ubuntu:act-latest
env:
RUNNER_TOOL_CACHE: /toolcache
steps:
- uses: actions/checkout@v3
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: ${{ inputs.maven-version }}
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '${{ inputs.java-version }}'
# cache: 'maven'
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-
# key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
# restore-keys: |
# ${{ runner.os }}-maven-
- name: Build with Maven
run: mvn --batch-mode package --file pom.xml -Dhttps.proxyHost=act_clash -Dhttps.proxyPort=7890 -Dhttp.proxyHost=act_clash -Dhttp.proxyPort=7890
- uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact-name }}
path: |
target
docker