-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 180a2a6
Showing
3 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
packages: write | ||
|
||
name: Create Release | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
releases_created: ${{ steps.release-please.outputs.releases_created }} | ||
tag_name: ${{ steps.release-please.outputs.tag_name }} | ||
major: ${{ steps.release-please.outputs.major }} | ||
minor: ${{ steps.release-please.outputs.minor }} | ||
patch: ${{ steps.release-please.outputs.patch }} | ||
sha: ${{ steps.release-please.outputs.sha }} | ||
|
||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
id: release-please | ||
with: | ||
release-type: simple | ||
package-name: fabric-server | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: release-please | ||
if: ${{ needs.release-please.outputs.releases_created }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
ghcr.io/anthonyporthouse/fabric-server | ||
tags: | | ||
type=raw,value=latest | ||
type=raw,value=${{needs.release-please.outputs.major}}.${{needs.release-please.outputs.minor}}.${{needs.release-please.outputs.patch}} | ||
type=raw,value=${{needs.release-please.outputs.major}}.${{needs.release-please.outputs.minor}} | ||
type=raw,value=${{needs.release-please.outputs.major}} | ||
type=sha | ||
- name: Build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: | | ||
linux/amd64 | ||
linux/arm64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
ARG JAVA_VERSION=17 | ||
|
||
FROM eclipse-temurin:${JAVA_VERSION} | ||
|
||
RUN apt update \ | ||
&& apt install -y jq \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
EXPOSE 25565 | ||
|
||
WORKDIR /minecraft | ||
|
||
ENV MINECRAFT_VERSION=1.20.2 | ||
|
||
ENV JAVA_OPTS="-Xms1G -Xmx2G" | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
ENTRYPOINT [ "/entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#! /usr/bin/env bash | ||
set -e | ||
|
||
JAR_NAME="server-${MINECRAFT_VERSION}.jar" | ||
|
||
if [ ! -f "$JAR_NAME" ]; then | ||
echo "Downloading Minecraft"; | ||
|
||
manifest=$(curl -s 'https://launchermeta.mojang.com/mc/game/version_manifest.json') | ||
version=$(jq -c ".versions[] | select( .id == \"$MINECRAFT_VERSION\" )" <<< "$manifest") | ||
version_manifest=$(curl -s "$(jq -r ".url" <<< "$version")") | ||
|
||
server_url=$(jq -r '.downloads.server.url' <<< "$version_manifest") | ||
|
||
curl -o "$JAR_NAME" -J "$server_url" | ||
fi | ||
|
||
echo "Accepting EULA" | ||
echo "eula=true" > eula.txt | ||
|
||
java ${JAVA_OPTS} -jar "$JAR_NAME" nogui |