diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 6c9b3cb..2eafd62 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -6,8 +6,6 @@ name: Build and test on: pull_request: branches: [ master, main ] - push: - branches: [ master, main ] jobs: build-and-test: diff --git a/.github/workflows/release-latest.yml b/.github/workflows/release-latest.yml new file mode 100644 index 0000000..5ecccc0 --- /dev/null +++ b/.github/workflows/release-latest.yml @@ -0,0 +1,44 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Release latest build + +on: + push: + branches: [ master, main ] + +jobs: + build-and-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup the workspace + run: ./gradlew setupCIWorkspace + + - name: Build the mod + run: ./gradlew build + + - name: Update latest tag + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest" + prerelease: false + title: "Latest build" + files: build/libs/*.jar diff --git a/.github/workflows/release-packages-latest.yml b/.github/workflows/release-packages-latest.yml new file mode 100644 index 0000000..1f1b162 --- /dev/null +++ b/.github/workflows/release-packages-latest.yml @@ -0,0 +1,72 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Release latest starter and migration packages + +on: + push: + branches: [ master, main ] + +jobs: + zip-and-release-packages: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Prepare release folder + run: | + mkdir packages + + - name: Zip starter + uses: montudor/action-zip@v1 + with: + args: > + zip -r packages/starter.zip . \ + \ + -x "*.git/*" \ + \ + -x ".github/scripts/update-version.sh" \ + -x ".github/workflows/buildscript-maintenance.yml" \ + -x ".github/workflows/release-packages-latest.yml" \ + -x ".github/workflows/release-packages-tags.yml" \ + \ + -x "*docs/*" \ + -x "README.md" \ + -x "LICENSE" \ + \ + -x "starter.zip" \ + -x "migration.zip" + + - name: Zip migration + uses: montudor/action-zip@v1 + with: + args: > + zip -r packages/migration.zip . \ + \ + -x "*.git/*" \ + \ + -x ".github/scripts/update-version.sh" \ + -x ".github/workflows/buildscript-maintenance.yml" \ + -x ".github/workflows/release-packages-latest.yml" \ + -x ".github/workflows/release-packages-tags.yml" \ + \ + -x "*docs/*" \ + -x "*src/*" \ + -x "LICENSE" \ + -x "README.md" \ + \ + -x "starter.zip" \ + -x "migration.zip" + + - name: Update latest tag + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest-packages" + prerelease: false + title: "Latest starter and migration packages" + files: packages/* diff --git a/.github/workflows/release-packages.yml b/.github/workflows/release-packages-tags.yml similarity index 82% rename from .github/workflows/release-packages.yml rename to .github/workflows/release-packages-tags.yml index 483b1ee..c256222 100644 --- a/.github/workflows/release-packages.yml +++ b/.github/workflows/release-packages-tags.yml @@ -31,7 +31,7 @@ jobs: \ -x ".github/scripts/update-version.sh" \ -x ".github/workflows/buildscript-maintenance.yml" \ - -x ".github/workflows/release-packages.yml" \ + -x ".github/workflows/release-packages-latest.yml" \ -x ".github/workflows/toolchain-compatibility.yml" \ \ -x "*docs/*" \ @@ -51,7 +51,8 @@ jobs: \ -x ".github/scripts/update-version.sh" \ -x ".github/workflows/buildscript-maintenance.yml" \ - -x ".github/workflows/release-packages.yml" \ + -x ".github/workflows/release-packages-latest.yml" \ + -x ".github/workflows/release-packages-tags.yml" \ -x ".github/workflows/toolchain-compatibility.yml" \ \ -x "*docs/*" \ @@ -70,12 +71,3 @@ jobs: prerelease: false title: "${{ env.RELEASE_VERSION }} starter and migration packages" files: packages/* - - - name: Update latest tag - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest-packages" - prerelease: false - title: "Latest starter and migration packages" - files: packages/* diff --git a/.github/workflows/release.yml b/.github/workflows/release-tags.yml similarity index 81% rename from .github/workflows/release.yml rename to .github/workflows/release-tags.yml index 05af834..3bc35d2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release-tags.yml @@ -43,12 +43,3 @@ jobs: prerelease: false title: "${{ env.RELEASE_VERSION }}" files: build/libs/*.jar - - - name: Update latest tag - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest" - prerelease: false - title: "Latest" - files: build/libs/*.jar diff --git a/build.gradle b/build.gradle index 754fd6f..a86c8b3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: ce57b88f4e61acd8b360c8e1777e707054d79b17 +//version: 48cd89fd62d2146ed27256473f89cedba4a22124 /* DO NOT CHANGE THIS FILE! @@ -251,29 +251,8 @@ task generateAssets { } shadowJar { - def manifestAttributes = [:] - if(containsMixinsAndOrCoreModOnly.toBoolean() == false) { - manifestAttributes += ["FMLCorePluginContainsFMLMod": true] - } - - if(accessTransformersFile) { - manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] - } - - if(coreModClass) { - manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] - } - - if(usesMixins.toBoolean()) { - from refMap - manifestAttributes += [ - "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs" : mixinConfigJson, - "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false - ] - } manifest { - attributes(manifestAttributes) + attributes(getManifestAttributes()) } minimize() @@ -282,29 +261,8 @@ shadowJar { } jar { - def manifestAttributes = [:] - if(containsMixinsAndOrCoreModOnly.toBoolean() == false) { - manifestAttributes += ["FMLCorePluginContainsFMLMod": true] - } - - if(accessTransformersFile) { - manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] - } - - if(coreModClass) { - manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] - } - - if(usesMixins.toBoolean()) { - from refMap - manifestAttributes += [ - "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs" : mixinConfigJson, - "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false - ] - } manifest { - attributes(manifestAttributes) + attributes(getManifestAttributes()) } if(usesShadowedDependencies.toBoolean()) { @@ -385,17 +343,41 @@ processResources from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - // replace version and mcversion - expand "minecraftVersion": project.minecraft.version, - "modVersion": versionDetails().lastTag, - "modId": modId, - "modName": modName + // replace version and mcversion + expand "minecraftVersion": project.minecraft.version, + "modVersion": versionDetails().lastTag, + "modId": modId, + "modName": modName + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } + } + +def getManifestAttributes() { + def manifestAttributes = [:] + if(containsMixinsAndOrCoreModOnly.toBoolean() == false) { + manifestAttributes += ["FMLCorePluginContainsFMLMod": true] } - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' + if(accessTransformersFile) { + manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] } + + if(coreModClass) { + manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] + } + + if(usesMixins.toBoolean()) { + manifestAttributes += [ + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : mixinConfigJson, + "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + ] + } + return manifestAttributes } task sourcesJar(type: Jar) { @@ -403,34 +385,8 @@ task sourcesJar(type: Jar) { from (file("$projectDir/LICENSE")) getArchiveClassifier().set('sources') - def manifestAttributes = [:] - if(containsMixinsAndOrCoreModOnly.toBoolean() == false) { - manifestAttributes += ["FMLCorePluginContainsFMLMod": true] - } - - if(accessTransformersFile) { - manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] - } - - if(coreModClass) { - manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] - } - - if(usesMixins.toBoolean()) { - from refMap - manifestAttributes += [ - "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs" : mixinConfigJson, - "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false - ] - } manifest { - attributes(manifestAttributes) - } - - if(usesShadowedDependencies.toBoolean()) { - dependsOn(shadowJar) - enabled = false + attributes(getManifestAttributes()) } } @@ -438,34 +394,8 @@ task devJar(type: Jar) { from sourceSets.main.output getArchiveClassifier().set("dev") - def manifestAttributes = [:] - if(containsMixinsAndOrCoreModOnly.toBoolean() == false) { - manifestAttributes += ["FMLCorePluginContainsFMLMod": true] - } - - if(accessTransformersFile) { - manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] - } - - if(coreModClass) { - manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] - } - - if(usesMixins.toBoolean()) { - from refMap - manifestAttributes += [ - "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs" : mixinConfigJson, - "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false - ] - } manifest { - attributes(manifestAttributes) - } - - if(usesShadowedDependencies.toBoolean()) { - dependsOn(shadowJar) - enabled = false + attributes(getManifestAttributes()) } }