Better build for other versions #7

Merged
Minecon724 merged 1 commit from universal into master 2024-12-28 19:56:43 +01:00
2 changed files with 42 additions and 4 deletions
Showing only changes of commit e32efe572a - Show all commits

View file

@ -16,17 +16,17 @@ jobs:
- name: Build for 1.21.1 - name: Build for 1.21.1
run: mkdir artifact && mvn clean package && mv target/tweaks-*+1.21.1.jar artifact/ run: mvn package -Dproject.minecraft.version=1.21.1 -Dproject.nms.version=v1_21_R1
- name: Build for 1.21.3 - name: Build for 1.21.3
run: find src \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s/v1_21_R1/v1_21_R2/g" && mvn clean package -Dproject.minecraft.version=1.21.3 && mv target/tweaks-*+1.21.3.jar artifact/ run: mvn package -Dproject.minecraft.version=1.21.3 -Dproject.nms.version=v1_21_R2
- name: Build for 1.21.4 - name: Build for 1.21.4
run: find src \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i "s/v1_21_R2/v1_21_R3/g" && mvn clean package -Dproject.minecraft.version=1.21.4 && mv target/tweaks-*+1.21.4.jar artifact/ run: mvn package -Dproject.minecraft.version=1.21.4 -Dproject.nms.version=v1_21_R3
- name: Upload artifacts - name: Upload artifacts
uses: https://github.com/actions/upload-artifact@v3 uses: https://github.com/actions/upload-artifact@v3
with: with:
path: artifact path: target

38
pom.xml
View file

@ -16,6 +16,8 @@
<maven.compiler.source>21</maven.compiler.source> <maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target> <maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.nms.version>v1_21_R1</project.nms.version>
<project.minecraft.version>1.21.1</project.minecraft.version> <project.minecraft.version>1.21.1</project.minecraft.version>
<project.spigot.version>${project.minecraft.version}-R0.1-SNAPSHOT</project.spigot.version> <project.spigot.version>${project.minecraft.version}-R0.1-SNAPSHOT</project.spigot.version>
</properties> </properties>
@ -29,6 +31,42 @@
</resource> </resource>
</resources> </resources>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>custom-nms-version</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<replace token="v1_21_R1" value="${project.nms.version}" dir="src/main">
<include name="**/*.java" />
</replace>
</target>
</configuration>
</execution>
<execution>
<id>cleanup-custom-nms-version</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<replace token="${project.nms.version}" value="v1_21_R1" dir="src/main">
<include name="**/*.java" />
</replace>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>