This repository was archived by the owner on Feb 25, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
61 lines (61 loc) · 2.19 KB
/
build.yml
File metadata and controls
61 lines (61 loc) · 2.19 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
name: Run Gradle Build
on: [push]
jobs:
gradle:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Get Gradle version and check if it's pre release
run: |
VERSION=$(grep -Po '^version=.*' gradle.properties | cut -d= -f2)
VERSION=${VERSION#[[:space:]]}
SHOULD_RELEASE=$(grep -Po '^shouldRelease=.*' gradle.properties | cut -d= -f2)
SHOULD_RELEASE=${SHOULD_RELEASE#[[:space:]]}
echo "$VERSION"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
if [[ $VERSION == *-pre* ]]
then
echo "Version is pre-release"
RELEASE_TYPE="pre-release"
else
echo "Version is full release"
RELEASE_TYPE="full"
fi
echo "Version is $VERSION and release type is $RELEASE_TYPE"
echo "RELEASE_TYPE=$RELEASE_TYPE" >> $GITHUB_OUTPUT
echo "shouldRelease=$SHOULD_RELEASE" >> $GITHUB_OUTPUT
id: get_version
- name: Get short commit sha
id: short_sha
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- uses: actions/setup-java@v4
name: Setup Java
with:
distribution: temurin
java-version: 17
- uses: gradle/actions/setup-gradle@v3
name: Setup Gradle
- name: Execute Gradle build
run: ./gradlew build
- uses: actions/upload-artifact@v4
name: Upload built mod JAR
with:
name: mod-jar
path: build/libs/*.jar
- name: Create release with files
uses: softprops/action-gh-release@v2
id: create_release
if: steps.get_version.outputs.shouldRelease == 'true'
with:
draft: false
prerelease: ${{ steps.get_version.outputs.RELEASE_TYPE == 'pre-release' }}
name: MightyMinerV2 ${{ steps.get_version.outputs.VERSION }}
tag_name: ${{ steps.get_version.outputs.VERSION }}.${{ steps.short_sha.outputs.sha_short }}
files: |
build/libs/*.jar
body: |
Changelog:
${{ github.event.head_commit.message }}
env:
GITHUB_TOKEN: ${{ github.token }}