-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (58 loc) · 2.09 KB
/
Copy pathrelease.yml
File metadata and controls
70 lines (58 loc) · 2.09 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
name: Create Release with ShadowJars
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
name: Build ShadowJars and Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
ref: main
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '25'
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Print Gradle Wrapper Properties
run: cat gradle/wrapper/gradle-wrapper.properties
- name: Clear Gradle Cache
run: rm -rf ~/.gradle/caches && rm -rf ~/.gradle/wrapper
- name: Build ShadowJars
run: ./gradlew clean build shadowJar
- name: Get Gradle Version
id: gradle_version
run: echo "GRADLE_VERSION=$(./gradlew properties -q | grep "version:" | awk '{print $2}')" >> $GITHUB_ENV
- name: Get Commit Hash
id: commit_hash
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Publish to Modrinth
run: ./gradlew modrinth && ./gradlew modrinthSyncBody
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
- name: Create Release
run: |
jars=()
# Find JAR files in any submodule's build/libs directory
for jar in $(find . -type f -name "*.jar" -path "*/build/libs/*.jar" -not -path "./build/libs/*"); do
# Check if the filename contains a version number (e.g., a dash followed by numbers)
if [[ $(basename "$jar") =~ -[0-9]+\.[0-9]+ ]]; then
echo "Skipping $jar due to version number"
else
echo "Uploading $jar"
jars+=("$jar")
fi
done
gh release create "v${GRADLE_VERSION}" \
--target main \
--title "v${GRADLE_VERSION}" \
--notes "This release contains release builds for all Gradle modules." \
"${jars[@]}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}