Browse Source

workflow that should work

tarfeef101 3 years ago
parent
commit
ec5495a21e
3 changed files with 32 additions and 2 deletions
  1. 30 0
      .github/workflows/check_for_new_and_build.yaml
  2. 1 1
      README.md
  3. 1 1
      docker-compose.yaml

+ 30 - 0
.github/workflows/check_for_new_and_build.yaml

@@ -0,0 +1,30 @@
+name: Check for new releases, and build
+
+on:
+  schedule:
+    - cron: '0 0 * * *'
+  workflow_dispatch:
+
+jobs:
+  check_and_build:
+    name: Check for new releases, and build
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: Get latest version
+        run: |
+          curl -sSL https://launchermeta.mojang.com/mc/game/version_manifest.json | jq -r '.latest.release' > /tmp/version
+          echo "version=$(cat /tmp/version)" >> $GITHUB_ENV
+
+      - name: Build and push
+        env:
+          DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
+          DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
+          VERSION: ${{ env.version }}
+        run: |
+          echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
+          docker-compose build --build-arg VERSION=$VERSION
+          docker tag tarfeef101/mc_java_vanilla:latest tarfeef101/mc_java_vanilla:$VERSION
+          docker push tarfeef101/mc_java_vanilla:$VERSION

+ 1 - 1
README.md

@@ -25,4 +25,4 @@ The Dockerfile tries to keep the image as simple and slim as possible. A slim ba
 This is the bind-mounted directory which will house your world data. This should be empty unless you have a pre-existing world you want to import. If you want to add resource packs, this is the place to put them.
 
 ## Building
-To build a new version, search for the JAR you're looking for at [MCVersions](https://mcversions.net/). Then, in the `docker-compose.yaml` file, set the `build` argument `JAR` to the URL of the file you wish to use. Then, run `docker-compose build` or `docker-compose up --build -d` (to just build, or build and start the server).
+To build a new version edit the `docker-compose.yaml` file, and set the `VERSION` argument to the version you wish to build. Then, run `docker-compose build` or `docker-compose up --build -d` (to just build, or build and start the server).

+ 1 - 1
docker-compose.yaml

@@ -6,7 +6,7 @@ services:
       context: .
       args:
         VERSION: 1.18.1
-    image: tarfeef101/mc_java_vanilla:alpine-1.18.1
+    image: tarfeef101/mc_java_vanilla:latest
     container_name: mc_java
     restart: on-failure
     environment: