Skip to content

Instantly share code, notes, and snippets.

@cocona20xx
Last active July 5, 2022 04:29
Show Gist options
  • Save cocona20xx/8dfe3410b34560f5611f98b08a14f2ae to your computer and use it in GitHub Desktop.
Save cocona20xx/8dfe3410b34560f5611f98b08a14f2ae to your computer and use it in GitHub Desktop.
Make Jitpack behave properly for Minecraft Modding on versions that need Java 17

Okay so to use this thing, you need to add it to all branches and all tags of your project that you want downloadable via jitpack.

For tags, this means you'll likely need to rerelease said tags with the jitpack.yml file added, this can be a bit tricky, so here's the steps.

  1. Get yourself the Github CLI tools: https://cli.github.com/, and authenticate your account with said tools. Instructions on how to use the Github CLI can be found here: https://cli.github.com/manual/
  2. Clone your repository (or a fork of it, if it isn't your project) into a local directory, and create a branch for each tag you need to update that is NOT up-to-date with the current main branch/branch for that minecraft version.
  3. For each brach corrisponding to a specific tag: a: run git checkout BRANCH_NAME_HERE, with BRANCH_NAME_HERE replaced with the name of the branch b: run git reset --hard TAG_NAME_HERE with TAG_NAME_HERE replaced with the name of the tag c: run git push -f origin BRANCH_NAME_HERE d: repeat this process for each branch that needs to be reset to an existing tag
  4. Next, commit the above jitpack.yml file to all jitpack fix branches created above.
  5. You will now need to delete and recreate the before mentioned tags locally: a: run git checkout BRANCH_NAME_HERE on the branch corrisponding to a target tag, which'll be referred to here as TARGET_TAG b: run git tag -d TARGET_TAG_NAME c: run git tag -a TARGET_TAG_NAME. Note that doing this will put you into a text editor, most likely vi or vim, to create a message for said tag. In both vi and vim, hit the ESC key, and type :wq, and then hit Enter to save the tag message and exit. d: Now, on github itself, delete the tag you just recreated locally. Via the website GUI, this can be done by navigating to the tags list by clicking on the tag icon with the number of total tags next to it. You will then need to view the page of the tag you wish to delete itself, and delete the tag from that page (via it's delete button). e: run git push --tags f: repeat this process for each branch and tag set
  6. All done! Sadly, this is quite the tedious process, but it's the only way to fix previously existing tags (as jitpack is horrible and you really shouldn't use it anyways).
before_install:
- export SDKMAN_DIR="/home/jitpack/sdkman" && curl -s "https://get.sdkman.io" | bash
- source "/home/jitpack/sdkman/bin/sdkman-init.sh"
- sdk install java 17.0.3-zulu
- sdk use java 17.0.3-zulu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment