diff --git a/.dockerignorefile b/.dockerignorefile index 717b807..a951f58 100644 --- a/.dockerignorefile +++ b/.dockerignorefile @@ -1,2 +1,3 @@ README.md -.git \ No newline at end of file +.git +.github \ No newline at end of file diff --git a/.github/workflows/docker-hub.yml b/.github/workflows/docker-hub.yml new file mode 100644 index 0000000..1a8547c --- /dev/null +++ b/.github/workflows/docker-hub.yml @@ -0,0 +1,37 @@ +name: Docker Hub Image Deploy + +on: + push: + branches: ["master"] + +jobs: + docker-image: + runs-on: ubuntu-latest + + permissions: + contents: read + + steps: + - name: Check out the repository + uses: actions/checkout@v4 + + - name: Extract SERVER_VERSION from launch.sh + id: extract-version + run: | + SERVER_VERSION=$(grep 'SERVER_VERSION=' launch.sh | cut -d '=' -f2) + echo "SERVER_VERSION=$SERVER_VERSION" >> $GITHUB_ENV + + - name: Log in to Docker Hub + uses: docker/login-action@v3.1.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push the Docker image + uses: docker/build-push-action@v5.3.0 + with: + context: . + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/allthemods10:latest + ${{ secrets.DOCKERHUB_USERNAME }}/allthemods10:${{ env.SERVER_VERSION }} diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b8c440d..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -description \ No newline at end of file diff --git a/launch.sh b/launch.sh index 29d9662..e179067 100644 --- a/launch.sh +++ b/launch.sh @@ -3,6 +3,7 @@ set -x NEOFORGE_VERSION=21.1.83 +SERVER_VERSION=1.27.0 cd /data if ! [[ "$EULA" = "false" ]]; then @@ -12,10 +13,10 @@ else exit 99 fi -if ! [[ -f 'Server-Files-1.27.0.zip' ]]; then +if ! [[ -f "Server-Files-$SERVER_VERSION.zip" ]]; then rm -fr config defaultconfigs kubejs mods packmenu Simple.zip forge* - curl -Lo 'Server-Files-1.27.0.zip' 'https://edge.forgecdn.net/files/5965/157/Server-Files-1.27.zip' || exit 9 - unzip -u -o 'Server-Files-1.27.0.zip' -d /data + curl -Lo "Server-Files-SERVER_VERSION.zip" 'https://edge.forgecdn.net/files/5965/157/Server-Files-1.27.zip' || exit 9 + unzip -u -o "Server-Files-$SERVER_VERSION.zip" -d /data DIR_TEST=$(find . -type d -maxdepth 1 | tail -1 | sed 's/^.\{2\}//g') if [[ $(find . -type d -maxdepth 1 | wc -l) -gt 1 ]]; then cd "${DIR_TEST}"