add: automatic server deployment

This commit is contained in:
iceBear67 committed 2026-07-22 15:36:24 +08:00
1 parent f702aac28c
commit c3ff43e0b3
24 files changed
+509 -49

No files matched your search

+74
View File
@@ -0,0 +1,74 @@
name: Build & Push Server Image
on:
workflow_dispatch:
push:
tags:
- "v*"
paths:
- "server-deploy/**"
- ".github/workflows/build-server-image.yml"
env:
REGISTRY: ghcr.io
# Image published as ghcr.io/<owner>/<repo> (metadata-action lowercases it).
IMAGE_NAME: ${{ github.repository }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
# The Dockerfile reads MC/loader versions from pack.toml itself; here we only
# need the MC version to derive the image tag.
- name: Extract MC version
id: pack
run: |
mc=$(grep '^minecraft' server-deploy/pack/pack.toml | head -n1 | cut -d'"' -f2)
if [ -z "$mc" ]; then echo "::error::could not read minecraft version from pack.toml"; exit 1; fi
echo "mc=$mc" >> "$GITHUB_OUTPUT"
echo "Minecraft=$mc"
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=mc-${{ steps.pack.outputs.mc }}
type=ref,event=branch
type=ref,event=tag
type=sha,format=short
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: server-deploy
file: server-deploy/Dockerfile
# mc-server-runner is downloaded as linux_amd64 in the Dockerfile.
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
-49
View File
@@ -1,49 +0,0 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Deploy to server
on:
workflow_dispatch:
push:
branches: [ "master", "rev/1.21.6" ]
jobs:
build:
if: github.event_name == 'schedule' || startsWith(github.event.head_commit.message, '(update)')
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '8.12'
- name: Build with Gradle Wrapper
run: gradle remapJar
- name: Install JQ
uses: dcarbone/install-jq-action@v2.1.0
- name: Upload Artifact
env:
API_ENDPOINT: ${{ secrets.API_ENDPOINT }}
SERVER_ID: ${{ secrets.SERVER_ID }}
TOKEN: ${{ secrets.TOKEN }}
UPLOAD_DIR: "../build/libs"
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
COMMIT_AUTHOR: ${{ github.event.head_commit.author.name }}
run: |
cd scripts
sh ./update.sh
+47
View File
@@ -0,0 +1,47 @@
FROM azul-zulu:25-jdk-alpine AS base
RUN apk update && apk add curl jq git
RUN curl -o /mc-server-runner.tar.gz https://github.com/itzg/mc-server-runner/releases/download/1.15.1/mc-server-runner_1.15.1_linux_amd64.tar.gz && \
tar -xzf /mc-server-runner.tar.gz -C / && \
rm /mc-server-runner.tar.gz && mv /mc-server-runner /usr/bin/mc-server-runner
RUN curl -o /packwiz-installer.jar https://github.com/packwiz/packwiz-installer-bootstrap/releases/download/v0.0.3/packwiz-installer-bootstrap.jar; \
curl -o /fabric-installer.jar https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.1.1/fabric-installer-1.1.1.jar
COPY --from=hengyunabc/arthas:4.1.1-no-jdk /opt/arthas /opt/arthas
FROM azul-zulu:25-jdk-alpine AS sfcraft-builder
RUN git clone https://github.com/saltedfishclub/sfcraft /mod
RUN cd /mod && \
./gradlew shadowJar && \
cp /mod/build/libs/sfcraft-*-all.jar /sfcraft.jar
FROM azul-zulu:25-jdk-alpine AS justbackup-builder
RUN git clone https://github.com/saltedfishclub/justbackup /mod
RUN cd /mod && \
./gradlew build && \
rm -f /mod/build/libs/*sources.jar /mod/build/libs/*dev.jar && \
cp /mod/build/libs/justbackup-1.0.0.jar /justbackup.jar
FROM azul-zulu:25-jdk-alpine AS carpet-builder
RUN git clone https://github.com/saltedfishclub/fabric-carpet /mod
RUN cd /mod && \
./gradlew build && \
rm -f /mod/build/libs/*sources.jar /mod/build/libs/*dev.jar && \
cp /mod/build/libs/*.jar /fabric-carpet.jar
FROM base
WORKDIR /deployment
COPY ./pack /deployment/pack
# Read MC + Fabric loader versions straight from the packwiz manifest (single source of truth).
RUN MC_VERSION="$(grep '^minecraft' /deployment/pack/pack.toml | head -n1 | cut -d'"' -f2)" && \
LOADER_VERSION="$(grep '^fabric' /deployment/pack/pack.toml | head -n1 | cut -d'"' -f2)" && \
if [ -z "$MC_VERSION" ] || [ -z "$LOADER_VERSION" ]; then \
echo "failed to read minecraft/fabric version from pack.toml" >&2; exit 1; \
fi && \
echo "Installing Fabric server (MC=$MC_VERSION, loader=$LOADER_VERSION)" && \
java -jar /fabric-installer.jar server -mcversion "$MC_VERSION" -loader "$LOADER_VERSION" -downloadMinecraft
RUN java -jar /packwiz-installer.jar -g -s server /deployment/pack/pack.toml
COPY ./overrides/* /deployment
COPY --from=sfcraft-builder /sfcraft.jar /deployment/mods/sfcraft.jar
COPY --from=justbackup-builder /justbackup.jar /deployment/mods/justbackup.jar
COPY --from=carpet-builder /fabric-carpet.jar /deployment/mods/fabric-carpet.jar
VOLUME ["/deployment/config","/deployment/world","/deployment/logs","/deployment/crash-reports", "/deployment/squaremap", "/deployment/backups"]
ENTRYPOINT ["mc-server-runner", "/deployment/run.sh"]
+1
View File
@@ -0,0 +1 @@
eula=true
+20
View File
@@ -0,0 +1,20 @@
[
{
"uuid": "5482c065-4ca3-4392-9487-966e5323b816",
"name": "_LittleC_",
"level": 4,
"bypassesPlayerLimit": false
},
{
"uuid": "71730433-512b-30d2-0000-000000000000",
"name": "iceBear67",
"level": 4,
"bypassesPlayerLimit": false
},
{
"uuid": "2c9cc686-d133-4350-9ebd-841ba68709cd",
"name": "iceBear67",
"level": 4,
"bypassesPlayerLimit": false
}
]
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
java -Xmx4G -jar ./fabric-server-launch.jar
+77
View File
@@ -0,0 +1,77 @@
#Minecraft server properties
#Tue Jul 21 19:16:01 UTC 2026
accepts-transfers=true
allow-flight=false
allow-nether=true
broadcast-console-to-ops=true
broadcast-rcon-to-ops=true
bug-report-link=
chat-spam-threshold-seconds=10
command-spam-threshold-seconds=10
difficulty=hard
enable-code-of-conduct=false
enable-command-block=true
enable-jmx-monitoring=false
enable-query=true
enable-rcon=false
enable-status=true
enforce-secure-profile=false
enforce-whitelist=false
entity-broadcast-range-percentage=100
force-gamemode=false
function-permission-level=2
gamemode=survival
generate-structures=true
generator-settings={}
hardcore=false
hide-online-players=false
initial-disabled-packs=
initial-enabled-packs=vanilla
level-name=world
level-seed=
level-type=minecraft\:normal
log-ips=true
management-server-allowed-origins=
management-server-enabled=false
management-server-host=localhost
management-server-port=0
management-server-secret=6Rx22UybnqanYvu3qmbvZDDwAF9r7UqwVnm74adH
management-server-tls-enabled=true
management-server-tls-keystore=
management-server-tls-keystore-password=
max-chained-neighbor-updates=1000000
max-players=20
max-tick-time=60000
max-world-size=29999984
motd=§b§lSaltedFish Club Server §r§8| §f26§6.2 §c§l+ 2.0\n§8§lINVITED PLAYERS ONLY. 服务器实行邀请制度.\n
network-compression-threshold=256
online-mode=true
op-permission-level=4
pause-when-empty-seconds=60
player-idle-timeout=2
prevent-proxy-connections=false
pvp=true
query.port=25565
rate-limit=0
rcon.password=
rcon.port=25575
region-file-compression=deflate
require-resource-pack=false
resource-pack=
resource-pack-id=
resource-pack-prompt=
resource-pack-sha1=
server-ip=0.0.0.0
server-port=25565
simulation-distance=10
spawn-animals=true
spawn-monsters=true
spawn-npcs=true
spawn-protection=16
status-heartbeat-interval=0
sync-chunk-writes=true
text-filtering-config=
text-filtering-version=0
use-native-transport=true
view-distance=10
white-list=true
+76
View File
@@ -0,0 +1,76 @@
hash-format = "sha256"
[[files]]
file = "mods/carpet-extra.pw.toml"
hash = "1aca75981bc81e31ce2ae719bc47cb44332c7bd633b9b87a2d3e08eb6a8751c6"
metafile = true
[[files]]
file = "mods/fabric-api.pw.toml"
hash = "dc5490cc1a9231b0d32ec3e72f9d34279fc1d1ff6fb5a7d288b1f36faec0a6a0"
metafile = true
[[files]]
file = "mods/fabric-permissions-api.pw.toml"
hash = "42b1a79c6ac2b23e1ad440f901ac42ed10180b340b8c69bb0755a9c55dbfb481"
metafile = true
[[files]]
file = "mods/farmers-delight-polymer.pw.toml"
hash = "ce231450983fd9afc2fef902a368394e9eea69b3c2772e5cdcabf777e8a2662c"
metafile = true
[[files]]
file = "mods/farmers-delight-refabricated.pw.toml"
hash = "1500f8fc3792a46226c0559af0925cf4da5f11b7224ec2dcaad8b66bc0c5ca4d"
metafile = true
[[files]]
file = "mods/ferrite-core.pw.toml"
hash = "069d81cab53c0141459ad4d70bcf3e10f17652f24cc62d3b4a0fc2cd2b700871"
metafile = true
[[files]]
file = "mods/jei.pw.toml"
hash = "6ed45647ca366b832d80de4f02d16dd5899ba165459b1870729be04a260515d1"
metafile = true
[[files]]
file = "mods/krypton.pw.toml"
hash = "e922d7300eba8cfbd9aa31ba475cf6fcbcf11d74e89a0314ada18d58f08a2634"
metafile = true
[[files]]
file = "mods/lithium.pw.toml"
hash = "3b4ab92dd5c39fbe0f5af3d73f0d7f3df3e2450842055353b0a5dc8fb9dae534"
metafile = true
[[files]]
file = "mods/no-chat-reports.pw.toml"
hash = "00129db538fe3591d87ba64731ca1f9daf3e538185657ee0fcf56b52f0715e5b"
metafile = true
[[files]]
file = "mods/polymer.pw.toml"
hash = "2a5626a6d9b61f968f294466e9756fbafa1c1208b4fb53c53cfc8d2afb42a857"
metafile = true
[[files]]
file = "mods/simple-voice-chat.pw.toml"
hash = "be7369da963f5326a771bbfa360365ac6ed939b01c2c268f4dd4a922718cd4a3"
metafile = true
[[files]]
file = "mods/squaremap.pw.toml"
hash = "798b2e1aeee88e52cc70cca4c51134639cebd214a3f52e0a0913e51b0b1adbe3"
metafile = true
[[files]]
file = "mods/syncmatica.pw.toml"
hash = "a8cfd56f9a2a99a9b93e05e41decad8c4b245bba7ed0b27a3032e5d6d1a09e23"
metafile = true
[[files]]
file = "mods/worldedit.pw.toml"
hash = "3754793742766dd72246e1a57abfa5c2d57e8a9d7dfecd1e9adc26251fac0b36"
metafile = true
@@ -0,0 +1,13 @@
name = "Carpet Extra"
filename = "carpet-extra-26.1-26.1.jar"
side = "both"
[download]
hash-format = "sha1"
hash = "1edeb62ff7486dab17186a4fb241dc72340e831d"
mode = "metadata:curseforge"
[update]
[update.curseforge]
file-id = 8292488
project-id = 349240
@@ -0,0 +1,13 @@
name = "Fabric API"
filename = "fabric-api-0.155.2+26.2.jar"
side = "both"
[download]
url = "https://cdn.modrinth.com/data/P7dR8mSH/versions/lVXlbH4w/fabric-api-0.155.2%2B26.2.jar"
hash-format = "sha512"
hash = "cc56984378a27c5bcd56374d6ffbb27a45c6bf3355add2ac6be9817ccac5854362249bf9d0147eb271a70fda2716129204e240d53c9aa876a2a7861f4c7f880f"
[update]
[update.modrinth]
mod-id = "P7dR8mSH"
version = "lVXlbH4w"
@@ -0,0 +1,13 @@
name = "fabric-permissions-api"
filename = "fabric-permissions-api-0.7.0.jar"
side = "server"
[download]
url = "https://cdn.modrinth.com/data/lzVo0Dll/versions/b1EqjxFs/fabric-permissions-api-0.7.0.jar"
hash-format = "sha512"
hash = "fd1961a4496cdc6cf22fbac0627a331407e97d3131f222641c1e370824adb3179e530e33e9e03adff1843e5556750edbb7abe0be7a241c7f0e3ca3ddc8b78ab7"
[update]
[update.modrinth]
mod-id = "lzVo0Dll"
version = "b1EqjxFs"
@@ -0,0 +1,13 @@
name = "Polymer Patch for Farmer's Delight"
filename = "farmers-delight-polymer-patch-3.6.7.0+26.2.jar"
side = "server"
[download]
url = "https://cdn.modrinth.com/data/TE3NCFiY/versions/11AvsXE3/farmers-delight-polymer-patch-3.6.7.0%2B26.2.jar"
hash-format = "sha512"
hash = "9e04f5c68e4209bd0e1de932858ebf4273c369b9943e38cbce8665311d7ff7d3fdfe20493e78769d9b92047678dff995e2d5d998f9978ab73896321ed125e09d"
[update]
[update.modrinth]
mod-id = "TE3NCFiY"
version = "11AvsXE3"
@@ -0,0 +1,13 @@
name = "Farmer's Delight Refabricated"
filename = "FarmersDelight-26.2-3.6.8+refabricated.jar"
side = "both"
[download]
url = "https://cdn.modrinth.com/data/7vxePowz/versions/PR6Lz8x8/FarmersDelight-26.2-3.6.8%2Brefabricated.jar"
hash-format = "sha512"
hash = "dbf6b0333d91c662c5657043b1f43865f1458c467921403b416df297e4335d3b7387b1bc52abeec76fa7414836a3a1a3bfb68aa8acc45694dfaf522c5d316c84"
[update]
[update.modrinth]
mod-id = "7vxePowz"
version = "PR6Lz8x8"
@@ -0,0 +1,13 @@
name = "FerriteCore"
filename = "ferritecore-9.0.0-fabric.jar"
side = "both"
[download]
url = "https://cdn.modrinth.com/data/uXXizFIs/versions/d5ddUdiB/ferritecore-9.0.0-fabric.jar"
hash-format = "sha512"
hash = "d81fa97e11784c19d42f89c2f433831d007603dd7193cee45fa177e4a6a9c52b384b198586e04a0f7f63cd996fed713322578bde9a8db57e1188854ae5cbe584"
[update]
[update.modrinth]
mod-id = "uXXizFIs"
version = "d5ddUdiB"
+13
View File
@@ -0,0 +1,13 @@
name = "Just Enough Items (JEI)"
filename = "jei-26.2-fabric-30.13.0.79.jar"
side = "both"
[download]
url = "https://cdn.modrinth.com/data/u6dRKJwZ/versions/RId9q9Qv/jei-26.2-fabric-30.13.0.79.jar"
hash-format = "sha512"
hash = "91460805a9b161272fbcd590ffefd9e0ec01dd00ec665311d7c1b5420d648435dfd624f62453aee3642cf7b8092a6d4b8447189271b7b5c6e437e2fb17166b5d"
[update]
[update.modrinth]
mod-id = "u6dRKJwZ"
version = "RId9q9Qv"
+13
View File
@@ -0,0 +1,13 @@
name = "Krypton"
filename = "krypton-0.3.1.jar"
side = "both"
[download]
url = "https://cdn.modrinth.com/data/fQEb0iXm/versions/5WeL0Nkz/krypton-0.3.1.jar"
hash-format = "sha512"
hash = "b8d9af34cd0050493afb8a6232cb8f785daa9d8887b7045f6e6a53c6bb9b5ffc4318fd9b0347a940eacfeba4773f10cb80ae0be1e79ce4c1888f96eda21e564e"
[update]
[update.modrinth]
mod-id = "fQEb0iXm"
version = "5WeL0Nkz"
+13
View File
@@ -0,0 +1,13 @@
name = "Lithium (Fabric/NeoForge)"
filename = "lithium-fabric-0.25.2+mc26.2.jar"
side = "both"
[download]
hash-format = "sha1"
hash = "3bcc94183d7068395de08915fd5fce8d199aaa50"
mode = "metadata:curseforge"
[update]
[update.curseforge]
file-id = 8409186
project-id = 360438
@@ -0,0 +1,13 @@
name = "No Chat Reports"
filename = "NoChatReports-FABRIC-26.2-v2.20.1.jar"
side = "both"
[download]
url = "https://cdn.modrinth.com/data/qQyHxfxd/versions/uiY9tUaj/NoChatReports-FABRIC-26.2-v2.20.1.jar"
hash-format = "sha512"
hash = "139dd09e04cc66fe4745264ddfbe3249be6e956326c931eb9707f9a640bbc011a4f1fd5684d04ca90e1b473be55772b0279e5c2f935c2f2e85d054e2ab0a6923"
[update]
[update.modrinth]
mod-id = "qQyHxfxd"
version = "uiY9tUaj"
+13
View File
@@ -0,0 +1,13 @@
name = "Polymer"
filename = "polymer-bundled-0.17.3+26.2.jar"
side = "both"
[download]
url = "https://cdn.modrinth.com/data/xGdtZczs/versions/w0N4I45x/polymer-bundled-0.17.3%2B26.2.jar"
hash-format = "sha512"
hash = "1459edf99834bbbb2eff5f7df2e7159688ad88e20e8704bc473752e81a755963bb96c511641d53c9f7b4e5867436f7b49ef839e3b857c48ca54af93627c2a110"
[update]
[update.modrinth]
mod-id = "xGdtZczs"
version = "w0N4I45x"
@@ -0,0 +1,13 @@
name = "Simple Voice Chat"
filename = "voicechat-fabric-2.6.21+26.2.jar"
side = "both"
[download]
url = "https://cdn.modrinth.com/data/9eGKb6K1/versions/3SOh5iiX/voicechat-fabric-2.6.21%2B26.2.jar"
hash-format = "sha512"
hash = "0308b2e18a05913faaf461530a475d2f5debbfb4d0a46107b512ce51166ceb6cfdbea468f7e21444a3e005655e51729c3764266f81c59b6228629b4866d16b28"
[update]
[update.modrinth]
mod-id = "9eGKb6K1"
version = "3SOh5iiX"
+13
View File
@@ -0,0 +1,13 @@
name = "squaremap"
filename = "squaremap-fabric-mc26.2-1.3.14.jar"
side = "both"
[download]
url = "https://cdn.modrinth.com/data/PFb7ZqK6/versions/VbqnAdLU/squaremap-fabric-mc26.2-1.3.14.jar"
hash-format = "sha512"
hash = "db0345134c109ccd2bc7fe67ae35dc561655ff25a14a42525d655012696bd10eaa999431b50a84335cc5960ec12ff5d34dddb75ee11bcf36252ac89cff86e71f"
[update]
[update.modrinth]
mod-id = "PFb7ZqK6"
version = "VbqnAdLU"
@@ -0,0 +1,13 @@
name = "Syncmatica"
filename = "syncmatica-fabric-26.2-0.3.19.jar"
side = "both"
[download]
url = "https://cdn.modrinth.com/data/bfneejKo/versions/f74T22XS/syncmatica-fabric-26.2-0.3.19.jar"
hash-format = "sha512"
hash = "e44660878dfdf80b2091e6206715cac0658dcc38b2b80ab36bd3e28e3a34a17c727f7f2206dc01d9d84f73096ee49656e51e1c47669d7e33f67f096e3a44e12a"
[update]
[update.modrinth]
mod-id = "bfneejKo"
version = "f74T22XS"
+13
View File
@@ -0,0 +1,13 @@
name = "WorldEdit"
filename = "worldedit-mod-7.4.4.jar"
side = "both"
[download]
url = "https://cdn.modrinth.com/data/1u6JkXh5/versions/j2w3GmPv/worldedit-mod-7.4.4.jar"
hash-format = "sha512"
hash = "48e408fbf3e24521f2a66155e9a85a71f5bf89657a9888aac9525e250c5dd9541d8326afbbc24eae4241dba83506a2438ebff60f0e763e37ecef8e070fa86e57"
[update]
[update.modrinth]
mod-id = "1u6JkXh5"
version = "j2w3GmPv"
+16
View File
@@ -0,0 +1,16 @@
name = "sfcraft"
author = "iceBear67"
version = "2.0"
pack-format = "packwiz:1.1.0"
[index]
file = "index.toml"
hash-format = "sha256"
hash = "f50035e12a81f99a134af8def67e700d438992ccca289901419855916d0dd239"
[versions]
fabric = "0.19.3"
minecraft = "26.2"
[options]
acceptable-game-versions = ["26.1", "26.1.2"]