blob: 9738849a8cc69b76bf4921bcef73dc54f5a10d37 (
plain)
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
name: Release
on:
push:
tags:
- 'v*'
jobs:
validate:
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.get_version.outputs.version }}
paper_jar_name: ${{ steps.get_version.outputs.paper_jar_name }}
velocity_jar_name: ${{ steps.get_version.outputs.velocity_jar_name }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Extract version from build.gradle.kts
id: get_version
run: |
VERSION=$(grep ' version = ' build.gradle.kts | sed 's/.*version = "\(.*\)"/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "paper_jar_name=LunaticChat-$VERSION-paper.jar" >> $GITHUB_OUTPUT
echo "velocity_jar_name=LunaticChat-$VERSION-velocity.jar" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION"
- name: Validate tag matches version
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
GRADLE_VERSION="${{ steps.get_version.outputs.version }}"
if [ "$TAG_VERSION" != "$GRADLE_VERSION" ]; then
echo "Error: Tag version ($TAG_VERSION) does not match build.gradle.kts version ($GRADLE_VERSION)"
exit 1
fi
echo "Version validation passed: $TAG_VERSION"
- name: Check if release already exists
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
if gh release view "$TAG_NAME" &> /dev/null; then
echo "Error: Release $TAG_NAME already exists"
exit 1
fi
echo "Release validation passed: $TAG_NAME does not exist yet"
build:
runs-on: ubuntu-24.04
needs: validate
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Development Environment
uses: jdx/mise-action@v3
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with shadowJar
run: ./gradlew :platform-paper:shadowJar :platform-velocity:shadowJar --parallel --no-daemon
- name: Upload build artifacts
uses: actions/upload-artifact@v6
with:
name: LunaticChat-v${{ needs.validate.outputs.version }}
path: |
platform-paper/build/libs/${{ needs.validate.outputs.paper_jar_name }}
platform-velocity/build/libs/${{ needs.validate.outputs.velocity_jar_name }}
retention-days: 90
release:
runs-on: ubuntu-24.04
needs: [validate, build]
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Download build artifact
uses: actions/download-artifact@v7
with:
name: LunaticChat-v${{ needs.validate.outputs.version }}
- name: Get current date
id: get_date
run: echo "current_date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
VERSION=${{ needs.validate.outputs.version }}
PAPER_JAR_NAME=${{ needs.validate.outputs.paper_jar_name }}
VELOCITY_JAR_NAME=${{ needs.validate.outputs.velocity_jar_name }}
gh release create "$TAG_NAME" \
"platform-paper/build/libs/$PAPER_JAR_NAME" \
"platform-velocity/build/libs/$VELOCITY_JAR_NAME" \
--title "$TAG_NAME" \
--draft \
--notes ""
- name: Publish to Modrinth
uses: cloudnode-pro/modrinth-publish@0a5268ad092d4727bb6424326746fa2fe88761ff # v2
with:
token: ${{ secrets.MODRINTH_TOKEN }}
name: LunaticChat v${{ needs.validate.outputs.version }}
project: ${{ secrets.MODRINTH_PROJECT_ID }}
version: ${{ needs.validate.outputs.version }}
channel: beta
changelog: |
Please refer to the [GitHub release](https://github.com/m1sk9/LunaticChat/releases/tag/v${{ needs.validate.outputs.version }}) for update details.
loaders: |
paper
velocity
game-versions: "1.21.x"
files: |
platform-paper/build/libs/${{ needs.validate.outputs.paper_jar_name }}
platform-velocity/build/libs/${{ needs.validate.outputs.velocity_jar_name }}
|