generated from MineBuilders/allaymc-kotlin-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (68 loc) · 2.61 KB
/
preview-build.yml
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
name: Build preview shared lib plugins
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Clone actions/upload-artifact repo
run: git clone https://github.com/actions/upload-artifact.git
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'zulu'
- name: Build and upload plugins dynamically?
run: |
chmod +x ./gradlew
# mkdir -p plugin/build/libs
for dir in plugin/*/; do
if [ -d "$dir" ]; then
dir_name=$(basename "$dir")
if [ "$dir_name" == "build" ]; then
continue
fi
echo "Building $dir_name"
./gradlew :plugin:"$dir_name":shadowJar
output_dir="plugin/$dir_name/build/libs"
jar_file=$(ls $output_dir/*.jar | grep -E ".*-all\.jar$")
if [ -z "$jar_file" ]; then
echo "No JAR file found in $output_dir for $dir_name"
exit 1
fi
base_name=$(basename "$jar_file" -all.jar)
# new_name="plugin/build/libs/kotlinx-${base_name}-${GITHUB_SHA}.jar"
new_name="${output_dir}/kotlinx-${base_name}-${GITHUB_SHA}.jar"
mv "$jar_file" "$new_name"
echo "Uploading artifact $new_name"
artifact_name="${base_name}-${GITHUB_SHA}"
# INPUT_NAME="$artifact_name" INPUT_PATH="$new_name" node upload-artifact/dist/upload/index.js
# NO WAY
fi
done
- name: Upload artifact (kotlinx)
uses: actions/upload-artifact@v4
with:
name: kotlinx-lib-${{ github.sha }}
path: plugin/kotlinx/build/libs/*.jar
# TODO: upload artifacts dynamically
# - name: Upload artifact (<MODULE_NAME>)
# uses: actions/upload-artifact@v4
# with:
# name: kotlinx-<MODULE_NAME>-lib-${{ github.sha }}
# path: plugin/<MODULE_NAME>/build/libs/*.jar
- name: Upload artifact (stdlib)
uses: actions/upload-artifact@v4
with:
name: kotlinx-stdlib-lib-${{ github.sha }}
path: plugin/stdlib/build/libs/*.jar
- name: Upload artifact (compose)
uses: actions/upload-artifact@v4
with:
name: kotlinx-compose-lib-${{ github.sha }}
path: plugin/compose/build/libs/*.jar