Skip to content

Commit

Permalink
v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehver committed Jun 7, 2024
1 parent 3a6235e commit ce92ab7
Show file tree
Hide file tree
Showing 391 changed files with 25,621 additions and 207 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Dockerfile linguist-detectable=true
§§template§§*.mcfunction linguist-language=dockerfile
*.html linguist-detectable=false
48 changes: 48 additions & 0 deletions .github/scripts/ClientPkgReformat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# pip install pyunpack patool

import sys
import os
import patoolib

def is_multi_part_zip(file_path):
z01_file = file_path[:-4] + ".z01" # Replace the last .zip with .z01
return os.path.exists(z01_file)

def delete_original_files(file_path):
base_name = file_path[:-4]
files_to_delete = [file_path] + [base_name + ext for ext in ['.zip', '.z01', '.z02', '.z03', '.z04', '.z05', '.z06', '.z07', '.z08', '.z09']]
for file in files_to_delete:
if os.path.exists(file):
os.remove(file)
print(f"Deleted: {file}")

def unzip_files(directory):
for root, dirs, files in os.walk(directory):
for file in files:
file_path = os.path.join(root, file)
if (file.endswith('.jar.zip') or file.endswith('.zip.zip')) and is_multi_part_zip(file_path):
print(f"Processing file: {file_path}")
try:
patoolib.extract_archive(file_path, outdir=root)
print(f"Unzipped: {file_path}")
# Delete original files after successful extraction
delete_original_files(file_path)
except Exception as e:
print(f"Error unzipping {file_path}: {e}")

def main():
if len(sys.argv) != 2:
print("Usage: ClientPkgReformat.py <DIRECTORY>")
sys.exit(1)

directory = sys.argv[1]

if not os.path.isdir(directory):
print(f"Error: {directory} is not a valid directory.")
sys.exit(1)

unzip_files(directory)

if __name__ == "__main__":
main()

3 changes: 1 addition & 2 deletions .github/scripts/UpdateVersionNumber.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def main():
old_version = sys.argv[2]
new_version = sys.argv[3]

# #§§template§§#§§template§§#§§template§§
update_version_number(repo_root, 'README.md', "utf-8", [9, 11, 12], old_version, new_version)
update_version_number(repo_root, 'README.md', "utf-8", [13, 15, 16], old_version, new_version)
# update_version_number(repo_root, '#README/README-cn.md', "utf-8", [3, 6], old_version, new_version)
# update_version_number(repo_root, 'Dockerfile', "utf-8", [16], old_version, new_version)

Expand Down
71 changes: 56 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,26 +103,41 @@ jobs:
REPO_NAME_LOWER=$(echo $REPO_NAME | tr '[:upper:]' '[:lower:]')
RELEASE_TAG=$(echo ${{ github.ref }} | sed 's/refs\/tags\///')
RELEASE_TAG_LOWER=$(echo $RELEASE_TAG | tr '[:upper:]' '[:lower:]')
TEMP_DIR="client-version-pkg_${REPO_NAME_LOWER}_${RELEASE_TAG_LOWER}"
TEMP_DIR="client-versionpack_${REPO_NAME_LOWER}_${RELEASE_TAG_LOWER}"
TEMP_MOD_DIR="client-modpack_${REPO_NAME_LOWER}_${RELEASE_TAG_LOWER}"
echo "::set-output name=repo_name::$REPO_NAME"
echo "::set-output name=repo_name_lower::$REPO_NAME_LOWER"
echo "::set-output name=release_tag::$RELEASE_TAG"
echo "::set-output name=release_tag_lower::$RELEASE_TAG_LOWER"
echo "::set-output name=temp_dir::$TEMP_DIR"
echo "::set-output name=temp_mod_dir::$TEMP_MOD_DIR"
- name: Create temporary directory
run: mkdir ${{ steps.vars.outputs.temp_dir }}
- name: Create temporary directory for version package
run: mkdir -p ${{ steps.vars.outputs.temp_dir }}

- name: Copy minecraft_client to temporary directory
run: cp -r minecraft_client ${{ steps.vars.outputs.temp_dir }}/${{ steps.vars.outputs.repo_name }}
- name: Copy minecraft_client_versionpack to temporary directory
run: cp -r minecraft_client_versionpack ${{ steps.vars.outputs.temp_dir }}/${{ steps.vars.outputs.repo_name }}

- name: Zip the directory
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install pyunpack patool
- name: Run ClientPkgReformat.py script
run: python .github/scripts/ClientPkgReformat.py ${{ steps.vars.outputs.temp_dir }}/${{ steps.vars.outputs.repo_name }}

- name: Zip the directory for version package
run: |
cd ${{ steps.vars.outputs.temp_dir }}
zip -r ../${{ steps.vars.outputs.temp_dir }}.zip .
cd ..
- name: Upload zip to release
- name: Upload version package zip to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
Expand All @@ -132,6 +147,28 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Create temporary directory for modpack
run: mkdir -p ${{ steps.vars.outputs.temp_mod_dir }}

- name: Copy minecraft_client_modpack to temporary directory for modpack
run: cp -r minecraft_client_modpack/* ${{ steps.vars.outputs.temp_mod_dir }}

- name: Zip the directory for modpack
run: |
cd ${{ steps.vars.outputs.temp_mod_dir }}
zip -r ../${{ steps.vars.outputs.temp_mod_dir }}.zip .
cd ..
- name: Upload modpack zip to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.vars.outputs.temp_mod_dir }}.zip
asset_name: ${{ steps.vars.outputs.temp_mod_dir }}.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

handle-file-uploads:
runs-on: ubuntu-latest

Expand All @@ -155,15 +192,18 @@ jobs:
tag_count=$(echo "$tags" | wc -w)
echo "Tag count: $tag_count"
if [ "$tag_count" -lt 2 ]; then
echo "Error: Not enough tags to determine previous tag." >&2
exit 1
fi
prev_tag=$(echo "$tags" | awk '{print $2}')
if [ -z "$prev_tag" ]; then
echo "Error: Could not determine previous tag." >&2
exit 1
echo "Not enough tags to determine previous tag."
echo "UPDATE_README=false" >> $GITHUB_ENV
prev_tag=""
else
prev_tag=$(echo "$tags" | awk '{print $2}')
if [ -z "$prev_tag" ]; then
echo "Error: Could not determine previous tag." >&2
exit 1
fi
echo "Previous tag is $prev_tag"
echo "UPDATE_README=true" >> $GITHUB_ENV
fi
echo "Previous tag is $prev_tag"
echo "PREV_TAG=$prev_tag" >> $GITHUB_ENV
- name: Get current tag
Expand All @@ -175,6 +215,7 @@ jobs:
run: echo "BRANCH=main" >> $GITHUB_ENV

- name: Update version numbers
if: env.PREV_TAG != ''
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
PREV_TAG: ${{ env.PREV_TAG }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
docker_test_server*/
docker_test_server*/
minecraft_client_versionpack/mods/Pixelmon-1.16.5-9.1.11-universal.jar
File renamed without changes.
2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 14 additions & 58 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,82 +1,38 @@
§§template§§§§template§§§§template§§

![Docker Image Size (tag)](https://img.shields.io/docker/image-size/opdmc/template-mcserver/v2.1?arch=amd64&label=AMD64%20v2.1&color=006688) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/opdmc/template-mcserver/v2.1?arch=arm64&label=ARM64%20v2.1&color=008866)

![Docker Image Size (tag)](https://img.shields.io/docker/image-size/opdmc/template-mcserver/v2.0?arch=amd64&label=AMD64%20v2.0&color=006688) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/opdmc/template-mcserver/v2.0?arch=arm64&label=ARM64%20v2.0&color=008866)
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/opdmc/1.16.5-opdmodpixelmon/v1.0?arch=amd64&label=AMD64%20v1.0&color=006688) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/opdmc/1.16.5-opdmodpixelmon/v1.0?arch=arm64&label=ARM64%20v1.0&color=008866)

---

# [Template-MCServer v2.1](https://github.com/OPDMC/Template-MCServer/releases/tag/v2.1)
# [1.16.5-OPDModPixelmon v1.0](https://github.com/OPDMC/1.16.5-OPDModPixelmon/releases/tag/v1.0)

> [!IMPORTANT]
>
> This project is merely a Docker packaging of a server created by others. The server and client modpack's author is the PixelmonMod team. Please respect the original author's copyright.
>
> By using this project, you acknowledge and agree that the [Minecraft EULA](https://account.mojang.com/documents/minecraft_eula) is automatically set to TRUE.
>
> 使用本项目即表示您承认并同意 [Minecraft EULA](https://account.mojang.com/documents/minecraft_eula) 已自动设置为 TRUE
>
> 此项目仅为对他人制作的服务器的 Docker 打包。此服务器和客户端模组包的作者是 PixelmonMod 团队。请尊重原作者版权
<a href='https://hub.docker.com/r/opdmc/template-mcserver'><img src="https://img.shields.io/badge/-DockerHub-1c90ed?style=flat&amp;logo=Docker&amp;logoColor=white" referrerpolicy="no-referrer" alt="DockerHub"></a> <a href='https://github.com/OPDMC/Template-MCServer/pkgs/container/template-mcserver'><img src="https://img.shields.io/badge/-Ghcr.io-8957E5?style=flat&amp;logo=GitHub&amp;logoColor=white" referrerpolicy="no-referrer" alt="Ghcr.io"></a>
<a href='https://hub.docker.com/r/opdmc/1.16.5-opdmodpixelmon'><img src="https://img.shields.io/badge/-DockerHub-1c90ed?style=flat&amp;logo=Docker&amp;logoColor=white" referrerpolicy="no-referrer" alt="DockerHub"></a> <a href='https://github.com/OPDMC/1.16.5-OPDModPixelmon/pkgs/container/1.16.5-opdmodpixelmon'><img src="https://img.shields.io/badge/-Ghcr.io-8957E5?style=flat&amp;logo=GitHub&amp;logoColor=white" referrerpolicy="no-referrer" alt="Ghcr.io"></a>

![Docker Image Size (tag)](https://img.shields.io/docker/image-size/opdmc/template-mcserver/v2.1?arch=amd64&label=AMD64%20v2.1&color=006688) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/opdmc/template-mcserver/v2.1?arch=arm64&label=ARM64%20v2.1&color=008866)
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/opdmc/1.16.5-opdmodpixelmon/v1.0?arch=amd64&label=AMD64%20v1.0&color=006688) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/opdmc/1.16.5-opdmodpixelmon/v1.0?arch=arm64&label=ARM64%20v1.0&color=008866)

### Usage

```shell
# DockerHub
docker pull opdmc/template-mcserver:v2.1
docker pull opdmc/1.16.5-opdmodpixelmon:v1.0
# Ghcr.io
docker pull ghcr.io/opdmc/template-mcserver:v2.1
docker pull ghcr.io/opdmc/1.16.5-opdmodpixelmon:v1.0
```

```shell
docker run -d \
--name=1.19.4-opdmc \
--name=1.16.5-opdmodpixelmon \
-p 127.0.0.1:80:25565/tcp \
-v /path/to/store/data:/minecraft \
opdmc/1.19.4-opdmodcarpet:latest
opdmc/1.16.5-opdmodpixelmon
```

### Changelog

**Full Changelog**: https://github.com/OPDMC/Template-MCServer/compare/v2.0...v2.1

# [Template-MCServer v2.0](https://github.com/OPDMC/Template-MCServer/releases/tag/v2.0)

> [!IMPORTANT]
> By using this project, you acknowledge and agree that the [Minecraft EULA](https://account.mojang.com/documents/minecraft_eula) is automatically set to TRUE.
>
> 使用本项目即表示您承认并同意 [Minecraft EULA](https://account.mojang.com/documents/minecraft_eula) 已自动设置为 TRUE。
<a href='https://hub.docker.com/r/opdmc/template-mcserver'><img src="https://img.shields.io/badge/-DockerHub-1c90ed?style=flat&amp;logo=Docker&amp;logoColor=white" referrerpolicy="no-referrer" alt="DockerHub"></a> <a href='https://github.com/OPDMC/Template-MCServer/pkgs/container/template-mcserver'><img src="https://img.shields.io/badge/-Ghcr.io-8957E5?style=flat&amp;logo=GitHub&amp;logoColor=white" referrerpolicy="no-referrer" alt="Ghcr.io"></a>

![Docker Image Size (tag)](https://img.shields.io/docker/image-size/opdmc/template-mcserver/v2.0?arch=amd64&label=AMD64%20v2.0&color=006688) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/opdmc/template-mcserver/v2.0?arch=arm64&label=ARM64%20v2.0&color=008866)

### Usage

```shell
# DockerHub
docker pull opdmc/template-mcserver:v2.0
# Ghcr.io
docker pull ghcr.io/opdmc/template-mcserver:v2.0
```

```shell
docker run -d \
--name=1.19.4-opdmc \
-p 127.0.0.1:80:25565/tcp \
-v /path/to/store/data:/minecraft \
opdmc/1.19.4-opdmodcarpet:latest
```

### Changelog

**Full Changelog**: https://github.com/OPDMC/Template-MCServer/compare/v1.0...v2.0

# [Template-MCServer v1.0](https://github.com/OPDMC/Template-MCServer/releases/tag/v1.0)

> [!IMPORTANT]
> By using this project, you acknowledge and agree that the [Minecraft EULA](https://account.mojang.com/documents/minecraft_eula) is automatically set to TRUE.
>
> 使用本项目即表示您承认并同意 [Minecraft EULA](https://account.mojang.com/documents/minecraft_eula) 已自动设置为 TRUE。
### Changelog

**Full Changelog**: https://github.com/OPDMC/Template-MCServer/commits/v1.0
**Full Changelog**: https://github.com/OPDMC/1.16.5-OPDModPixelmon/commits/v1.0
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# §§template§§
FROM openjdk:17-slim-bullseye
# §§template§§
FROM openjdk:11-slim-bullseye
RUN apt-get update && apt-get install -y dos2unix
ENV EULA=TRUE
WORKDIR /minecraft
COPY ./minecraft_server /docker_init
COPY docker-init.sh ../init.sh
RUN dos2unix ../init.sh && chmod +x ../init.sh
RUN dos2unix /docker_init/Install.sh && chmod +x /docker_init/Install.sh
RUN dos2unix /docker_init/settings.sh && chmod +x /docker_init/settings.sh
RUN dos2unix /docker_init/start.sh && chmod +x /docker_init/start.sh
WORKDIR /docker_init
RUN ./Install.sh
WORKDIR /minecraft
EXPOSE 25565
ENTRYPOINT [ "sh", "../init.sh" ]
Loading

0 comments on commit ce92ab7

Please sign in to comment.