diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..c88f735 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,109 @@ +name: Publish on GitHub, Curseforge and Modrinth + +on: + push: + tags: + - 'v*' + +jobs: + setup: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Make Gradle Wrapper Executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + + validation: + needs: setup + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: gradle/wrapper-validation-action@v3 + + version: + needs: setup + outputs: + version_number: "${{ steps.version_number.outputs.result }}" + version_type: "${{ steps.version_type.outputs.result }}" + steps: + - name: Get Version + id: version_number + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + result-encoding: string + script: | + let ref = '${{ github.ref }}'; + return ref.startsWith('refs/tags/v') ? ref.replace('refs/tags/v', '') : 'indev'; + + - name: Get Version Type + id: version_type + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + result-encoding: string + script: | + let version = '${{ steps.version.outputs.result }}'; + return version.includes('alpha') ? 'alpha' : (version.includes('beta') ? 'beta' : 'release'); + + main: + needs: [ setup, validation, version ] + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read + packages: write + env: + VERSION: ${{ needs.version.outputs.version_number }} + VERSION_TYPE: ${{ needs.version.outputs.version_type }} + + steps: + - name: Log Version Info + run: echo "version = $VERSION, type = $VERSION_TYPE" + + - name: Build + uses: gradle/gradle-build-action@v2 + with: + arguments: build + + - name: Publish (CurseForge/Modrinth/GitHub) + uses: Kir-Antipov/mc-publish@v3.2 + with: + # TODO update this after ensuring CI produces a working jar + # modrinth-id: PhnM3Lkv + # modrinth-token: ${{ secrets.MODRINTH_API_KEY }} + # + # curseforge-id: 695822 + # curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }} + + github-tag: ${{ github.ref }} + github-draft: true + github-prerelease: false + github-token: ${{ secrets.GITHUB_TOKEN }} + + name: "Sacks 'N Such-1.20.1-${{ env.VERSION }}" + version: "${{ env.VERSION }}" + version-type: "${{ env.VERSION_TYPE }}" + + files: | + build/libs/!(*-@(dev|sources|javadoc))-all.jar + + loaders: | + forge + neoforge + + game-versions: "1.20.1" + java: 17 + changelog-file: CHANGELOG.md \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a7d9aef --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +### Bug fixes + +- Fix duplication bug when picking up items which entirely refill all partial slots with at least one left over + +### Changes + +- Added new tag 'allowed_in_ore_sack' for items which can go into ore sacks (wow crazy) +- Not ugly Icon courtesy of Aleki \ No newline at end of file diff --git a/build.gradle b/build.gradle index fe13fbc..f522827 100644 --- a/build.gradle +++ b/build.gradle @@ -34,6 +34,8 @@ final String mappingsVersion = project.findProperty("mappings_version") as Strin final boolean minifyResources = project.findProperty("minify_resources") as Boolean ?: true final boolean useAdvancedClassRedef = project.findProperty("use_advanced_class_redefinition") as Boolean ?: false +final String modVersion = System.getenv("VERSION") ?: "0.0.0-indev" + base { archivesName.set("$modName-$minecraftVersion") group = "mod.traister101" // http://maven.apache.org/guides/mini/guide-naming-conventions.html @@ -161,7 +163,15 @@ repositories { includeGroup "vazkii.patchouli" } } - mavenLocal() + maven { + name "Extended Slot Capacity github package" + // https://github.com/Traister101/ExtendedSlotCapacity + url uri("https://maven.pkg.github.com/traister101/ExtendedSlotCapacity") + credentials { + username = project.findProperty("githubUser") ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("githubToken") ?: System.getenv("GITHUB_TOKEN") + } + } } dependencies { @@ -179,7 +189,6 @@ dependencies { annotationProcessor("org.spongepowered:mixin:0.8.5:processor") - // https://github.com/Traister101/ExtendedSlotCapacity implementation jarJar(fg.deobf("mod.traister101:Extended-Slot-Capacity-1.20.1:$extendedSlotCapacityVersion")) { jarJar.ranged(it as Dependency, "[$extendedSlotCapacityVersion,)") } diff --git a/gradle.properties b/gradle.properties index 975c7c7..bb5ba30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,6 @@ org.gradle.daemon=false # Mod stuff modID=sns modName=Sacks \'N Such -modVersion=1.0.0 # MC version minecraftVersion=1.20.1 # Forge version