Skip to content

Commit f2cb7ae

Browse files
committed
ci: add GitHub Actions workflows to build plugin and publish releases
- build.yml: builds the shadow jar on every push/PR and uploads it as an artifact for verification. - release.yml: triggered by pushing a v* tag (or manual dispatch), builds the plugin and attaches the shadow jar to a GitHub Release. - fetch-libs.sh: downloads the compile-time-only jars (PlaceholderAPI, CMI/CMILib, HolographicDisplays, FancyHolograms, IridiumColorAPI) from public sources, since lib/ is gitignored.
1 parent df09fe7 commit f2cb7ae

4 files changed

Lines changed: 155 additions & 0 deletions

File tree

.github/scripts/fetch-libs.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
# Downloads compile-time-only dependencies that build.gradle references via
3+
# `compileOnly files("lib/...")` and `implementation files("lib/...")`.
4+
# These jars are gitignored, so CI fetches them from public sources.
5+
set -euo pipefail
6+
7+
mkdir -p lib
8+
cd lib
9+
10+
fetch() {
11+
local url="$1"
12+
local out="$2"
13+
if [ -f "$out" ]; then
14+
echo "[skip] $out already present"
15+
return 0
16+
fi
17+
echo "[get ] $out <- $url"
18+
curl -fsSL --retry 4 --retry-delay 2 -o "$out" "$url"
19+
}
20+
21+
# PlaceholderAPI
22+
fetch "https://repo.extendedclip.com/releases/me/clip/placeholderapi/2.11.2/placeholderapi-2.11.2.jar" \
23+
"PlaceholderAPI-2.11.2.jar"
24+
25+
# CMI + CMILib (official Zrips repo)
26+
fetch "https://nexus.zrips.net/repository/zrips/CMI/9.6.2.3/CMI-9.6.2.3.jar" \
27+
"CMI-9.6.2.3.jar"
28+
fetch "https://nexus.zrips.net/repository/zrips/CMILib/1.4.0.4/CMILib-1.4.0.4.jar" \
29+
"CMILib-1.4.0.4.jar"
30+
31+
# HolographicDisplays
32+
fetch "https://github.com/filoghost/HolographicDisplays/releases/download/v3.0.4/HolographicDisplays-3.0.4.jar" \
33+
"HolographicDisplays-3.0.4.jar"
34+
35+
# FancyHolograms
36+
fetch "https://github.com/FancyMcPlugins/FancyHolograms/releases/download/v2.4.1/FancyHolograms-2.4.1.jar" \
37+
"FancyHolograms-2.4.1.jar"
38+
39+
# IridiumColorAPI (shaded into the plugin) - via jitpack
40+
fetch "https://jitpack.io/com/github/Iridium-Development/IridiumColorAPI/1.0.4/IridiumColorAPI-1.0.4.jar" \
41+
"IridiumColorAPI-1.0.4.jar"
42+
43+
echo "----"
44+
ls -la

.github/workflows/build.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ "**" ]
6+
tags-ignore: [ "v*" ]
7+
pull_request:
8+
branches: [ "**" ]
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Set up JDK 17
20+
uses: actions/setup-java@v4
21+
with:
22+
distribution: temurin
23+
java-version: 17
24+
25+
- name: Set up Gradle
26+
uses: gradle/actions/setup-gradle@v3
27+
28+
- name: Fetch compile-time libraries
29+
run: bash .github/scripts/fetch-libs.sh
30+
31+
- name: Build with Gradle
32+
run: ./gradlew clean shadowJar --no-daemon --stacktrace
33+
34+
- name: Read project version
35+
id: version
36+
run: |
37+
VERSION=$(grep -E "^version" build.gradle | head -n1 | sed -E 's/.*"([^"]+)".*/\1/')
38+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
39+
40+
- name: Upload build artifact
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: FireMysteryBlocks-${{ steps.version.outputs.version }}
44+
path: target/${{ steps.version.outputs.version }}/*.jar
45+
if-no-files-found: error

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Release tag (e.g. v2.3.16). If empty, uses the version from build.gradle."
11+
required: false
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Set up JDK 17
25+
uses: actions/setup-java@v4
26+
with:
27+
distribution: temurin
28+
java-version: 17
29+
30+
- name: Set up Gradle
31+
uses: gradle/actions/setup-gradle@v3
32+
33+
- name: Fetch compile-time libraries
34+
run: bash .github/scripts/fetch-libs.sh
35+
36+
- name: Build with Gradle
37+
run: ./gradlew clean shadowJar --no-daemon --stacktrace
38+
39+
- name: Resolve version and tag
40+
id: meta
41+
run: |
42+
PROJECT_VERSION=$(grep -E "^version" build.gradle | head -n1 | sed -E 's/.*"([^"]+)".*/\1/')
43+
echo "version=$PROJECT_VERSION" >> "$GITHUB_OUTPUT"
44+
45+
if [ "${{ github.event_name }}" = "push" ]; then
46+
TAG="${GITHUB_REF#refs/tags/}"
47+
elif [ -n "${{ github.event.inputs.tag }}" ]; then
48+
TAG="${{ github.event.inputs.tag }}"
49+
else
50+
TAG="v${PROJECT_VERSION}"
51+
fi
52+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
53+
54+
- name: List built artifacts
55+
run: ls -la target/${{ steps.meta.outputs.version }}/
56+
57+
- name: Create GitHub Release
58+
uses: softprops/action-gh-release@v2
59+
with:
60+
tag_name: ${{ steps.meta.outputs.tag }}
61+
name: FireMysteryBlocks ${{ steps.meta.outputs.tag }}
62+
generate_release_notes: true
63+
draft: false
64+
prerelease: false
65+
files: |
66+
target/${{ steps.meta.outputs.version }}/*.jar

gradlew

100644100755
File mode changed.

0 commit comments

Comments
 (0)