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

View File

@@ -6,6 +6,12 @@ on:
artifact-name: artifact-name:
required: true required: true
type: string type: string
docker_context:
required: true
type: string
dockerfile_path:
required: true
type: string
jobs: jobs:
@@ -59,8 +65,8 @@ jobs:
http_proxy=http://192.168.0.20:7890 http_proxy=http://192.168.0.20:7890
https_proxy=http://192.168.0.20:7890 https_proxy=http://192.168.0.20:7890
version=${{ steps.meta.outputs.REPO_VERSION }} version=${{ steps.meta.outputs.REPO_VERSION }}
context: . context: ${{ inputs.docker_context }}
file: ./docker/Dockerfile file: ${{ inputs.dockerfile_path }}
platforms: | platforms: |
linux/amd64 linux/amd64
linux/arm64 linux/arm64