-
Notifications
You must be signed in to change notification settings - Fork 3
Feat/multiversion multiloader #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f42e0ac
first working version
LucHeart b8d3b05
fix 26.2 loader warning
LucHeart 53bbc31
specify java version to use for each
LucHeart 26147f5
add 1.20.4, 1.21, 1.21.5
LucHeart 1fd0c86
add release workflow
LucHeart 0384c47
fix review comments
LucHeart File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,42 @@ | ||
| # Automatically build the project and run any configured tests for every push | ||
| # and submitted pull request. This can help catch issues that only occur on | ||
| # certain platforms or Java versions, and provides a first line of defence | ||
| # against bad commits. | ||
| # Builds every Minecraft version / loader combination declared in settings.gradle.kts. | ||
| # Stonecutter fans the build out across all targets; chiseledBuildAndCollect gathers the | ||
| # resulting jars into the root build/libs directory. | ||
|
|
||
| name: build | ||
| on: [pull_request, push] | ||
|
|
||
| jobs: | ||
| build: | ||
| strategy: | ||
| matrix: | ||
| # Use these Java versions | ||
| java: [ | ||
| 21, # Current Java LTS | ||
| ] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: checkout repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
|
|
||
| - name: validate gradle wrapper | ||
| uses: gradle/actions/wrapper-validation@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | ||
| - name: setup jdk ${{ matrix.java }} | ||
|
|
||
| # 1.21.x targets compile against Java 21, 26.x targets against Java 25. | ||
| # Both toolchains have to be present for the whole matrix to build in one pass. | ||
| - name: setup jdks | ||
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 | ||
| with: | ||
| java-version: ${{ matrix.java }} | ||
| distribution: 'microsoft' | ||
| java-version: | | ||
| 17 | ||
| 21 | ||
| 25 | ||
| distribution: 'temurin' | ||
|
|
||
| - name: setup gradle | ||
| uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | ||
|
|
||
| - name: make gradle wrapper executable | ||
| run: chmod +x ./gradlew | ||
| - name: build | ||
| run: ./gradlew build | ||
|
|
||
| - name: build all versions | ||
| run: ./gradlew chiseledBuildAndCollect --stacktrace | ||
|
|
||
| - name: capture build artifacts | ||
| if: ${{ matrix.java == '21' }} # Only upload artifacts built from latest java on one OS | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: Mod Jars | ||
| path: build/libs/ | ||
| path: build/libs/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| # Publishes every Minecraft version / loader combination to Modrinth and CurseForge, and attaches | ||
| # the jars to the GitHub release, when a version tag is pushed (e.g. 1.4.0, 1.4.0-beta.1). | ||
| # | ||
| # Required repository secrets: | ||
| # MODRINTH_TOKEN - Modrinth PAT with "Create versions" scope | ||
| # CURSEFORGE_TOKEN - CurseForge API token | ||
| # | ||
| # Required repository variables (Settings -> Secrets and variables -> Actions -> Variables): | ||
| # MODRINTH_ID - Modrinth project id (e.g. DwMSqx5B) | ||
| # CURSEFORGE_ID - CurseForge numeric project id (e.g. 980833) | ||
| # CURSEFORGE_SLUG - CurseForge project slug (e.g. openshock-shockcraft) | ||
| # | ||
| # Nothing is uploaded unless PUBLISH_RELEASE is true, so this workflow is the only thing that can | ||
| # publish; running publishMods anywhere else is a dry run. | ||
|
|
||
| name: release | ||
| on: | ||
| push: | ||
| # Version tags carry no prefix. This pattern uses only [] and *, which GitHub's tag filters | ||
| # definitely support, so a release can never silently fail to trigger. | ||
| tags: | ||
| - '[0-9]*' | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: checkout repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
|
|
||
| - name: validate gradle wrapper | ||
| uses: gradle/actions/wrapper-validation@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | ||
|
|
||
| - name: setup jdks | ||
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 | ||
| with: | ||
| java-version: | | ||
| 17 | ||
| 21 | ||
| 25 | ||
| distribution: 'temurin' | ||
|
|
||
| - name: setup gradle | ||
| uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | ||
|
|
||
| # The tag is the source of truth for the published version: tag 1.4.0 publishes 1.4.0. | ||
| # | ||
| # It also decides the release type in one place so GitHub and the mod platforms cannot | ||
| # disagree. Stonecraft infers a type from the version string but only recognises alpha, | ||
| # beta and next - an "rc" tag would otherwise reach Modrinth and CurseForge as stable. | ||
| # Setting RELEASE_TYPE explicitly overrides that inference. | ||
| - name: derive version and release type from tag | ||
| id: version | ||
| run: | | ||
| case "$GITHUB_REF_NAME" in | ||
| *alpha*) release_type=alpha ;; | ||
| *beta*|*next*|*rc*) release_type=beta ;; | ||
| *) release_type=stable ;; | ||
| esac | ||
| if [ "$release_type" = stable ]; then prerelease=""; else prerelease="--prerelease"; fi | ||
| { | ||
| echo "version=$GITHUB_REF_NAME" | ||
| echo "release_type=$release_type" | ||
| echo "prerelease=$prerelease" | ||
| } >> "$GITHUB_OUTPUT" | ||
|
|
||
| # An unset variable expands to an empty string, which still counts as "present" to Gradle, so | ||
| # check before spending ten minutes building only to publish with a blank project id. | ||
| - name: check publishing credentials | ||
| env: | ||
| MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | ||
| MODRINTH_ID: ${{ vars.MODRINTH_ID }} | ||
| CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} | ||
| CURSEFORGE_ID: ${{ vars.CURSEFORGE_ID }} | ||
| CURSEFORGE_SLUG: ${{ vars.CURSEFORGE_SLUG }} | ||
| run: | | ||
| missing="" | ||
| for name in MODRINTH_TOKEN MODRINTH_ID CURSEFORGE_TOKEN CURSEFORGE_ID CURSEFORGE_SLUG; do | ||
| [ -n "${!name}" ] || missing="$missing $name" | ||
| done | ||
| if [ -n "$missing" ]; then | ||
| echo "::error::Missing required secrets/variables:$missing" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: build all versions | ||
| env: | ||
| MOD_VERSION: ${{ steps.version.outputs.version }} | ||
| run: ./gradlew chiseledBuildAndCollect -Pmod.version="$MOD_VERSION" --stacktrace | ||
|
|
||
| - name: create github release | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| PRERELEASE: ${{ steps.version.outputs.prerelease }} | ||
| run: | | ||
| gh release create "$GITHUB_REF_NAME" \ | ||
| --title "$GITHUB_REF_NAME" \ | ||
| --generate-notes \ | ||
| $PRERELEASE \ | ||
| build/libs/*.jar | ||
|
|
||
| - name: publish to modrinth and curseforge | ||
| env: | ||
| PUBLISH_RELEASE: 'true' | ||
| RELEASE_TYPE: ${{ steps.version.outputs.release_type }} | ||
| # Point at the GitHub release rather than duplicating its notes on each platform. | ||
| CHANGELOG: "Full changelog: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}" | ||
| MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | ||
| MODRINTH_ID: ${{ vars.MODRINTH_ID }} | ||
| CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} | ||
| CURSEFORGE_ID: ${{ vars.CURSEFORGE_ID }} | ||
| CURSEFORGE_SLUG: ${{ vars.CURSEFORGE_SLUG }} | ||
| MOD_VERSION: ${{ steps.version.outputs.version }} | ||
| run: ./gradlew chiseledPublishMods -Pmod.version="$MOD_VERSION" --stacktrace | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.