Skip to content
This repository was archived by the owner on Jul 22, 2026. It is now read-only.

Commit 8b99d55

Browse files
committed
Add GitHub Actions release workflow and Maven pom
Add a release/build workflow (.github/workflows/release.yml) that builds the project with Java 17 on push/PR/manual runs, uploads the jar as a workflow artifact, and creates a GitHub Release when a v* tag is pushed. Add a basic Maven pom.xml (version 1.3.3) with project metadata, Velocity API as a provided dependency, and compiler settings. Update .gitignore to exclude Maven target/ output and extend README with automated build and release instructions (how to tag to trigger a release).
1 parent 7917978 commit 8b99d55

4 files changed

Lines changed: 127 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
tags:
9+
- 'v*'
10+
pull_request:
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
build:
18+
name: Build plugin
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Java
26+
uses: actions/setup-java@v4
27+
with:
28+
distribution: temurin
29+
java-version: '17'
30+
cache: maven
31+
32+
- name: Build jar
33+
run: mvn -B package
34+
35+
- name: Upload jar artifact
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: craftengine-pack-gate
39+
path: target/*.jar
40+
if-no-files-found: error
41+
42+
release:
43+
name: Create GitHub release
44+
needs: build
45+
if: startsWith(github.ref, 'refs/tags/v')
46+
runs-on: ubuntu-latest
47+
permissions:
48+
contents: write
49+
50+
steps:
51+
- name: Download jar artifact
52+
uses: actions/download-artifact@v4
53+
with:
54+
name: craftengine-pack-gate
55+
path: dist
56+
57+
- name: Create release and upload jar
58+
env:
59+
GH_TOKEN: ${{ github.token }}
60+
run: gh release create "$GITHUB_REF_NAME" dist/*.jar --title "$GITHUB_REF_NAME" --generate-notes

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
*.tar.gz
2020
*.rar
2121

22+
# Maven build output
23+
target/
24+
2225
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2326
hs_err_pid*
2427
replay_pid*

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,21 @@ When it receives `resend` or `resend:<sha>`, it reloads config/cache state, clea
102102
4. 确认日志出现 `CraftEnginePackGate enabled`
103103
5. 进入配置的后端服务器,并查看 Velocity 日志中是否出现 `Sent CraftEngine resource pack ...`
104104

105+
## Automated Builds / 自动构建
106+
107+
GitHub Actions builds the plugin on every push to `main`/`master`, every pull request, and manual workflow runs. The compiled jar is uploaded as a workflow artifact.
108+
109+
GitHub Actions 会在每次推送到 `main`/`master`、每个 pull request,以及手动运行 workflow 时自动构建插件,并把编译好的 jar 上传为 workflow artifact。
110+
111+
To publish a GitHub Release, push a version tag:
112+
113+
```powershell
114+
git tag v1.3.3
115+
git push origin v1.3.3
116+
```
117+
118+
推送 `v*` 版本标签后,workflow 会自动创建同名 GitHub Release,并把 jar 上传到 release assets。
119+
105120
## Verification / 验证
106121

107122
- Cache files contain valid JSON with `url` and `sha1`.

pom.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.ellan</groupId>
8+
<artifactId>craftengine-pack-gate</artifactId>
9+
<version>1.3.3</version>
10+
<packaging>jar</packaging>
11+
12+
<name>CraftEnginePackGate</name>
13+
<description>Sends mandatory CraftEngine resource packs after players join backend servers.</description>
14+
15+
<properties>
16+
<maven.compiler.release>17</maven.compiler.release>
17+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18+
<velocity.version>3.4.0</velocity.version>
19+
</properties>
20+
21+
<repositories>
22+
<repository>
23+
<id>papermc</id>
24+
<url>https://repo.papermc.io/repository/maven-public/</url>
25+
</repository>
26+
</repositories>
27+
28+
<dependencies>
29+
<dependency>
30+
<groupId>com.velocitypowered</groupId>
31+
<artifactId>velocity-api</artifactId>
32+
<version>${velocity.version}</version>
33+
<scope>provided</scope>
34+
</dependency>
35+
</dependencies>
36+
37+
<build>
38+
<plugins>
39+
<plugin>
40+
<groupId>org.apache.maven.plugins</groupId>
41+
<artifactId>maven-compiler-plugin</artifactId>
42+
<version>3.13.0</version>
43+
<configuration>
44+
<proc>none</proc>
45+
</configuration>
46+
</plugin>
47+
</plugins>
48+
</build>
49+
</project>

0 commit comments

Comments
 (0)