Skip to content

Commit

Permalink
feat: Added server workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-siebert authored Dec 20, 2024
1 parent 93d433b commit 0b65ac6
Show file tree
Hide file tree
Showing 6 changed files with 367 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Publish workflow
on:
push:

env:
REGISTRY: ghcr.io

permissions:
contents: write
packages: write

jobs:
build:
if: ( github.event_name == 'push' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') ) )
runs-on: ubuntu-latest
strategy:
matrix:
projects:
- path: ./
name: salmon
outputs:
image: ${{ steps.image-ref.outputs.image }}
image_latest: ${{ steps.image-ref.outputs.image_latest }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create image ref
id: image-ref
run: |
REF=$(git rev-parse --short $GITHUB_SHA)
IMAGE=${{ env.REGISTRY }}/${{ github.repository }}-${{ matrix.projects.name }}:${REF}
IMAGE_LATEST=${{ env.REGISTRY }}/${{ github.repository }}-${{ matrix.projects.name }}:latest
echo "image=${IMAGE}" >> $GITHUB_STATE
echo "image_latest=${IMAGE_LATEST}" >> $GITHUB_OUTPUT
echo "${IMAGE}" >> $GITHUB_STEP_SUMMARY
- name: Build and push docker image
uses: docker/build-push-action@v6
with:
context: ${{ matrix.projects.path }}
file: ${{ matrix.projects.path }}/Dockerfile
push: true
platforms: linux/amd64,linux/arm64,windows/amd64,windows/arm64,darwin/amd64,darwin/arm64,linux/arm/v7,linux/arm/v8,linux/s390x
cache-from: type=registry,ref=${{ steps.image-ref.outputs.image_latest }}
cache-to: type=inline
tags: |
${{ steps.image-ref.outputs.image }}
${{ steps.image-ref.outputs.image_latest }}
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM --platform=$BUILDPLATFORM debian AS build

WORKDIR /paper

COPY ./server.properties /paper/server.properties
COPY ./bukkit.yml /paper/bukkit.yml
COPY ./spigot.yml /paper/spigot.yml

COPY install.sh /paper/installer.sh

RUN apt-get update
RUN apt-get install jq curl -y
RUN chmod +x ./installer.sh && ./installer.sh
RUN rm ./installer.sh -rf


FROM --platform=$BUILDPLATFORM ghcr.io/graalvm/graalvm-community AS RUN

Check warning on line 17 in Dockerfile

View workflow job for this annotation

GitHub Actions / build (./, salmon)

Stage names should be lowercase

StageNameCasing: Stage name 'RUN' should be lowercase More info: https://docs.docker.com/go/dockerfile/rule/stage-name-casing/

WORKDIR /paper

COPY --from=BUILD /paper/ /paper

EXPOSE 25565

CMD ["java", "-Xmx2G", "-Xms2G", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseJVMCICompiler", "-Dcom.mojang.eula.agree=true", "-jar", "paperclip.jar", "--nogui"]
32 changes: 32 additions & 0 deletions bukkit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
settings:
allow-end: false
warn-on-overload: true
permissions-file: permissions.yml
update-folder: update
plugin-profiling: false
connection-throttle: 4000
query-plugins: true
deprecated-verbose: default
shutdown-message: Server closed
minimum-api: none
use-map-color-cache: true
spawn-limits:
monsters: -1
animals: -1
water-animals: -1
water-ambient: -1
water-underground-creature: -1
axolotls: -1
ambient: -1
chunk-gc:
period-in-ticks: 1200
ticks-per:
animal-spawns: -1
monster-spawns: -1
water-spawns: -1
water-ambient-spawns: -1
water-underground-creature-spawns: -1
axolotl-spawns: -1
ambient-spawns: -1
autosave: -1
aliases: now-in-commands.yml
17 changes: 17 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env sh

PROJECT="paper"
MINECRAFT_VERSION="1.21.3"

LATEST_BUILD=$(curl -s https://api.papermc.io/v2/projects/${PROJECT}/versions/${MINECRAFT_VERSION}/builds | \
jq -r '.builds | map(select(.channel == "default") | .build) | .[-1]')

if [ "$LATEST_BUILD" != "null" ]; then
JAR_NAME=${PROJECT}-${MINECRAFT_VERSION}-${LATEST_BUILD}.jar
PAPERMC_URL="https://api.papermc.io/v2/projects/${PROJECT}/versions/${MINECRAFT_VERSION}/builds/${LATEST_BUILD}/downloads/${JAR_NAME}"

curl -o paperclip.jar $PAPERMC_URL
echo "Download completed"
else
echo "No stable build for version $MINECRAFT_VERSION found :("
fi
63 changes: 63 additions & 0 deletions server.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
accept-transfers=false
allow-flight=true
allow-nether=false
broadcast-console-to-ops=false
broadcast-rcon-to-ops=false
bug-report-link=
debug=false
difficulty=peaceful
enable-command-block=false
enable-jmx-monitoring=false
enable-query=false
enable-rcon=false
enable-status=false
enforce-secure-profile=false
enforce-whitelist=false
entity-broadcast-range-percentage=100
force-gamemode=false
function-permission-level=2
gamemode=survival
generate-structures=false
generator-settings={}
hardcore=false
hide-online-players=false
initial-disabled-packs=
initial-enabled-packs=vanilla
level-name=world
level-seed=
level-type=minecraft:flat
log-ips=false
max-chained-neighbor-updates=1000000
max-players=100
max-tick-time=60000
max-world-size=29999984
motd=A dummy server
network-compression-threshold=-1
online-mode=false
op-permission-level=4
pause-when-empty-seconds=-1
player-idle-timeout=0
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=
server-port=25565
simulation-distance=10
spawn-animals=false
spawn-monsters=false
spawn-npcs=false
spawn-protection=16
sync-chunk-writes=false
text-filtering-config=
use-native-transport=true
view-distance=10
white-list=false
169 changes: 169 additions & 0 deletions spigot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
messages:
whitelist: You are not whitelisted on this server!
unknown-command: Unknown command. Type "/help" for help.
server-full: The server is full!
outdated-client: Outdated client! Please use {0}
outdated-server: Outdated server! I'm still on {0}
restart: Server is restarting
settings:
bungeecord: true
save-user-cache-on-stop-only: true
sample-count: 12
player-shuffle: 0
user-cache-size: 1000
moved-wrongly-threshold: 0.0625
moved-too-quickly-multiplier: 10.0
timeout-time: 60
restart-on-crash: true
restart-script: ./start.sh
netty-threads: 4
attribute:
maxAbsorption:
max: 2048.0
maxHealth:
max: 2048.0
movementSpeed:
max: 2048.0
attackDamage:
max: 2048.0
log-villager-deaths: true
log-named-deaths: true
debug: false
commands:
tab-complete: 0
send-namespaced: true
log: true
spam-exclusions:
- /skill
silent-commandblock-console: false
replace-commands:
- setblock
- summon
- testforblock
- tellraw
advancements:
disable-saving: true
disabled:
- '*'
world-settings:
default:
below-zero-generation-in-existing-chunks: true
view-distance: default
simulation-distance: default
thunder-chance: 100000
merge-radius:
item: 0.5
exp: -1.0
mob-spawn-range: 8
item-despawn-rate: 6000
arrow-despawn-rate: 1200
trident-despawn-rate: 1200
zombie-aggressive-towards-villager: true
nerf-spawner-mobs: false
enable-zombie-pigmen-portal-spawns: true
wither-spawn-sound-radius: 0
end-portal-sound-radius: 0
hanging-tick-frequency: 100
unload-frozen-chunks: false
growth:
cactus-modifier: 100
cane-modifier: 100
melon-modifier: 100
mushroom-modifier: 100
pumpkin-modifier: 100
sapling-modifier: 100
beetroot-modifier: 100
carrot-modifier: 100
potato-modifier: 100
torchflower-modifier: 100
wheat-modifier: 100
netherwart-modifier: 100
vine-modifier: 100
cocoa-modifier: 100
bamboo-modifier: 100
sweetberry-modifier: 100
kelp-modifier: 100
twistingvines-modifier: 100
weepingvines-modifier: 100
cavevines-modifier: 100
glowberry-modifier: 100
pitcherplant-modifier: 100
entity-activation-range:
animals: 32
monsters: 32
raiders: 64
misc: 16
water: 16
villagers: 32
flying-monsters: 32
wake-up-inactive:
animals-max-per-tick: 4
animals-every: 1200
animals-for: 100
monsters-max-per-tick: 8
monsters-every: 400
monsters-for: 100
villagers-max-per-tick: 4
villagers-every: 600
villagers-for: 100
flying-monsters-max-per-tick: 8
flying-monsters-every: 200
flying-monsters-for: 100
villagers-work-immunity-after: 100
villagers-work-immunity-for: 20
villagers-active-for-panic: true
tick-inactive-villagers: true
ignore-spectators: false
entity-tracking-range:
players: 128
animals: 96
monsters: 96
misc: 96
display: 128
other: 64
ticks-per:
hopper-transfer: 8
hopper-check: 1
hopper-amount: 1
hopper-can-load-chunks: false
dragon-death-sound-radius: 0
seed-village: 10387312
seed-desert: 14357617
seed-igloo: 14357618
seed-jungle: 14357619
seed-swamp: 14357620
seed-monument: 10387313
seed-shipwreck: 165745295
seed-ocean: 14357621
seed-outpost: 165745296
seed-endcity: 10387313
seed-slime: 987234911
seed-nether: 30084232
seed-mansion: 10387319
seed-fossil: 14357921
seed-portal: 34222645
seed-ancientcity: 20083232
seed-trailruins: 83469867
seed-trialchambers: 94251327
seed-buriedtreasure: 10387320
seed-mineshaft: default
seed-stronghold: default
hunger:
jump-walk-exhaustion: 0.05
jump-sprint-exhaustion: 0.2
combat-exhaustion: 0.1
regen-exhaustion: 6.0
swim-multiplier: 0.01
sprint-multiplier: 0.1
other-multiplier: 0.0
max-tnt-per-tick: 100
max-tick-time:
tile: 50
entity: 50
verbose: false
players:
disable-saving: true
config-version: 12
stats:
disable-saving: true
forced-stats: {}

0 comments on commit 0b65ac6

Please sign in to comment.