From 286b6df579ad8290b19338dad5f10e78e578b3bb Mon Sep 17 00:00:00 2001 From: LifeIsAParadox Date: Tue, 25 Jan 2022 00:59:23 +0100 Subject: [skip ci] --- .github/workflows/buildrelease.yml | 92 ++++++++++++++++++++++++++++++++++++++ build.gradle | 5 ++- gradle.properties | 3 +- src/main/resources/fabric.mod.json | 5 +-- 4 files changed, 99 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/buildrelease.yml diff --git a/.github/workflows/buildrelease.yml b/.github/workflows/buildrelease.yml new file mode 100644 index 00000000..b1fa84d8 --- /dev/null +++ b/.github/workflows/buildrelease.yml @@ -0,0 +1,92 @@ +# This is a basic workflow to help you get started with Actions + +name: Build Release + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + release: + types: [created] + +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '17' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build + + - uses: actions/upload-artifact@v2 + with: + name: Artifacts + path: build/libs/ + + - name: Read Changelog + id: read_changelog + shell: bash + run: | + CHANGELOG=$(sed '/___/Q' CHANGELOG.md | grep -v '# ') + echo "Changelog:\n$CHANGELOG" + CHANGELOG="${CHANGELOG//'%'/'%25'}" + CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" + CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" + echo "::set-output name=changelog::$CHANGELOG" + + - uses: actions/github-script@v2 + id: fname + with: + result-encoding: string + script: | + const fs = require("fs") + return fs.readdirSync("build/libs/").filter(e => !e.endsWith("dev.jar") && !e.endsWith("sources.jar") && e.endsWith(".jar"))[0] + - name: Release + id: uploadrelease + uses: softprops/action-gh-release@v1 + with: + body: ${{ steps.read_changelog.outputs.changelog }} + files: build/libs/${{ steps.fname.outputs.result }} + + - name: Publish to Modrinth + id: modrinth + env: + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + CHANGELOG: ${{ steps.read_changelog.outputs.changelog }} + run: ./gradlew publishModrinth + + - name: Get version tag + id: version_tag + run: | + [[ ! "$GITHUB_REF" =~ refs/tags ]] && exit + echo "::set-output name=value::${GITHUB_REF#refs/tags/}" + + - name: Discord notification + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + uses: Ilshidur/action-discord@master + with: + args: | + "@here" + "Skyblocker ${{ steps.version_tag.outputs.value }}" + "" + "Changelog" + "```md" + "${{ steps.read_changelog.outputs.changelog }}" + "```" + ":inbox_tray: Download latest version on Modrinth or Github:" + "<:modrinth:900697862206287882> <${{ steps.modrinth.outputs.url }}>" + "<:github:900697885706952725> <${{ steps.uploadrelease.outputs.url }}>" + "" + "" \ No newline at end of file diff --git a/build.gradle b/build.gradle index fc535314..a05703ab 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 archivesBaseName = project.archives_base_name -version = "${project.mod_version}+${project.minecraft_version}" +version = "${project.mod_version}+${project.suported_version}" group = project.maven_group repositories { @@ -103,8 +103,9 @@ task publishModrinth(type: TaskModrinthUpload) { token = System.getenv('MODRINTH_TOKEN') projectId = project.modrinth_id versionNumber = "v${project.version}" - versionName = "Skyblocker ${project.mod_version} (${project.minecraft_version})" + versionName = "Skyblocker ${project.mod_version} (${project.suported_version})" uploadFile = remapJar + addGameVersion('1.17.1') addGameVersion((String) project.minecraft_version) addLoader('fabric') versionType = VersionType.RELEASE diff --git a/gradle.properties b/gradle.properties index a9840524..3952ba70 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,4 +18,5 @@ mod_menu_version=3.0.0 mod_version = 1.4.3 maven_group = me.xmrvizzy archives_base_name = skyblocker -modrinth_id=y6DuFGwJ \ No newline at end of file +modrinth_id=y6DuFGwJ +suported_version=1.17.x-1.18.x \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 09320692..8ef1482d 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -5,7 +5,7 @@ "name": "Skyblocker", "description": "Hypixel Skyblock Mod", "authors": ["xMrVizzy", "d3dx9", "LifeIsAParadox"], - "contributors": ["ExternalTime", "Zailer43"], + "contributors": ["ExternalTime", "Zailer43", "TacoMonkey"], "contact": { "homepage": "https://hysky.de", "sources": "https://github.com/LifeIsAParadox/Skyblocker", @@ -29,8 +29,7 @@ "fabricloader": ">=0.12.11", "fabric": "*", "cloth-config2": "*", - "minecraft": "1.18.x", - "java": ">=17" + "minecraft": ["1.18.x","1.17.x"] }, "custom": { "modmenu": { -- cgit