-
Notifications
You must be signed in to change notification settings - Fork 5
91 lines (83 loc) · 2.66 KB
/
flex-build.yml
File metadata and controls
91 lines (83 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
name: Flex Build
"on":
workflow_call:
inputs:
dir:
description: Directory to build
required: true
type: string
mc:
description: Minecraft version
type: string
lex:
description: LexForge version
type: string
neo:
description: NeoForge version
type: string
java:
description: Java version
required: true
type: string
upload:
description: Upload the build artifacts
default: true
type: boolean
publish:
description: Run Gradle publish
default: false
type: boolean
jobs:
build: # TODO: add build attestation and generate then combine gradle dependency graphs for SBOM
name: Build ${{ inputs.dir }}/${{ inputs.mc }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 1
sparse-checkout: |
api
${{ inputs.dir }}
- name: Cache build
id: cache
uses: actions/cache@v5
with:
path: ${{ inputs.dir }}/build
key: build-${{ inputs.mc }}-${{ hashFiles(format('{0}/[a-z]**', inputs.dir), 'api/**') }}
- if: steps.cache.outputs.cache-hit != 'true'
name: Setup Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: ${{ inputs.java }}
- if: steps.cache.outputs.cache-hit != 'true'
name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
with:
workflow-job-context: '{}' # FIXME: avoid this cache duplication workaround
- if: |
steps.cache.outputs.cache-hit != 'true'
&& !inputs.release
name: Gradle build
run: >
./gradlew build --stacktrace
-Pminecraft_version=${{ inputs.mc }}
-Plexforge_version=${{ inputs.lex }}
-Pneoforge_version=${{ inputs.neo }}
working-directory: ${{ inputs.dir }}
- if: inputs.release
name: Gradle publish
env:
IS_MAVEN_PUB: true
DEPLOY_TO_GITHUB_PACKAGES_URL: https://maven.pkg.github.com/${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew publish
working-directory: ${{ inputs.dir }}
- if: inputs.upload
name: Upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: jars-${{ inputs.mc || inputs.dir }}${{ inputs.dir == 'gametest' && '-gametest' || '' }}
path: ${{ inputs.dir }}/build/libs/*.jar