-
Notifications
You must be signed in to change notification settings - Fork 14
102 lines (89 loc) · 2.91 KB
/
Copy pathbuild.yml
File metadata and controls
102 lines (89 loc) · 2.91 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
92
93
94
95
96
97
98
99
100
101
102
name: build
on:
workflow_dispatch:
workflow_call:
inputs:
release:
type: boolean
required: false
description: ''
default: false
tag:
type: string
required: false
ref:
type: string
required: false
description: Git ref/branch to checkout; empty uses the triggering ref
default: ''
artifact_name:
type: string
required: false
description: Upload artifact name
default: 'build-artifacts'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out (triggering ref)
if: ${{ inputs.ref == '' }}
uses: actions/checkout@v4
- name: Check out (specified ref)
if: ${{ inputs.ref != '' }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Resolve CI Java / build task
id: ci_meta
run: |
JAVA=$(grep -E '^[[:space:]]*ci_java_version[[:space:]]*=' gradle.properties | tail -1 | cut -d= -f2- | tr -d ' \r' || true)
TASK=$(grep -E '^[[:space:]]*ci_build_task[[:space:]]*=' gradle.properties | tail -1 | cut -d= -f2- | tr -d ' \r' || true)
echo "java=${JAVA:-21}" >> "$GITHUB_OUTPUT"
echo "task=${TASK:-remapJar}" >> "$GITHUB_OUTPUT"
echo "Resolved ci_java_version=${JAVA:-21} ci_build_task=${TASK:-remapJar}"
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ steps.ci_meta.outputs.java }}
distribution: 'temurin'
- name: Cache gradle files
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
./.gradle/loom-cache
key: ${{ runner.os }}-gradle-${{ inputs.ref || github.ref_name }}-${{ hashFiles('*.gradle', 'gradle.properties', '**/*.accesswidener') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew ${{ steps.ci_meta.outputs.task }} --no-daemon
env:
BUILD_TAG: ${{ inputs.tag }}
BUILD_ID: ${{ github.run_number }}
BUILD_RELEASE: ${{ inputs.release }}
- name: Upload JAR file
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact_name }}
path: |
./*/build/libs/
!./*/build/libs/*shadow*.jar
!./*/build/libs/*source*.jar
!./common/build/libs/
!./cli/build/libs/
summary:
runs-on: ubuntu-22.04
needs:
- build
steps:
- uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact_name }}
path: build-artifacts
- name: Make build summary
run: python3 .github/workflows/scripts/summary.py