From b726b65e9edd62d88be826b2774f8c9659d12de3 Mon Sep 17 00:00:00 2001 From: samo_lego <34912839+samolego@users.noreply.github.com> Date: Thu, 30 Apr 2020 10:28:48 +0200 Subject: [PATCH] 20w18a and workflow update --- .github/workflows/building.yml | 44 ++++++++++++++++++++++++++++++++++ .github/workflows/gradle.yml | 26 -------------------- gradle.properties | 8 +++---- renaming.sh | 29 ++++++++++++++++++++++ 4 files changed, 77 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/building.yml delete mode 100644 .github/workflows/gradle.yml create mode 100644 renaming.sh diff --git a/.github/workflows/building.yml b/.github/workflows/building.yml new file mode 100644 index 0000000..238b3db --- /dev/null +++ b/.github/workflows/building.yml @@ -0,0 +1,44 @@ +# This workflow will build a Java project with Gradle +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Gradle Build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Fetching branches + run: | + git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build + - name: Execute permission for renaming script + run: chmod +x renaming.sh + - name: Running renaming script + run: ./renaming.sh + + # Publishing to dev-builds branch + - name: GitHub Pages + if: success() + uses: crazy-max/ghaction-github-pages@v1.4.0 + with: + build_dir: build/libs + target_branch: dev-builds + keep_history: false + env: + GITHUB_PAT: ${{ secrets.pat }} diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml deleted file mode 100644 index 58e1c59..0000000 --- a/.github/workflows/gradle.yml +++ /dev/null @@ -1,26 +0,0 @@ -# This workflow will build a Java project with Gradle -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle - -name: Java CI with Gradle - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew build diff --git a/gradle.properties b/gradle.properties index 17f9907..45ccedf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,12 +2,12 @@ org.gradle.jvmargs=-Xmx1G # Fabric properties -minecraft_version=20w17a -yarn_mappings=20w17a+build.2 +minecraft_version=20w18a +yarn_mappings=20w18a+build.1 loader_version=0.8.2+build.194 #Fabric api -fabric_version=0.6.2+build.327-1.16 +fabric_version=0.7.0+build.330-1.16 # Mod Properties mod_version = 1.4.1 @@ -15,4 +15,4 @@ fabric_version=0.6.2+build.327-1.16 archives_base_name = simpleauth # Carpet for debugging -carpet_core_version = 1.3.20+v200422 +carpet_core_version = 1.3.21+v200429 diff --git a/renaming.sh b/renaming.sh new file mode 100644 index 0000000..281b714 --- /dev/null +++ b/renaming.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +cd ./build/libs + +# Deleting the development and sources files +echo "Deleting dev jars." +rm *sources* +rm *dev* + +cd ../../ + +# Moving older builds to the build/libs folder (from dev-builds branch) +git checkout origin/dev-builds *.jar +mv *.jar ./build/libs + +# Cleaning up old dev builds, if there are more than 10 +echo "Cleaning old dev builds" +ls ./build/libs -1tr | tail -n +10 | xargs rm -f + +# Setting the variables +projectName="`grep '"id":' src/main/resources/fabric.mod.json | sed 's/"id"://g;s/ //g;s/,//g;s/"//g'`" +version="`grep 'mod_version' gradle.properties | grep -o '[0-9]*\.[0-9]*\.[0-9]*'`" +mcVersion="`grep 'minecraft_version' gradle.properties | grep -o '[0-9]*\.[0-9]*\.[0-9]*'`" + +cd ./build/libs + +echo "Build is going to be renamed: $projectName-$version-devbuild_$GITHUB_RUN_NUMBER-MC_$mcVersion.jar" +# Renaming the dev build +mv "$projectName-$version.jar" "$projectName-$version-devbuild_$GITHUB_RUN_NUMBER-MC_$mcVersion.jar"