From afd3f0f861ebe7f8957eb6abc6e19f92c7b5896a Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Fri, 12 Apr 2024 14:32:41 +0200 Subject: Add in-game updater (#1050) Co-authored-by: IRONM00N <64110067+IRONM00N@users.noreply.github.com> --- CONTRIBUTING.md | 127 ++++++++++++++++---------------------------------------- 1 file changed, 36 insertions(+), 91 deletions(-) (limited to 'CONTRIBUTING.md') diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f77d0334..0d8b8ab9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,110 +49,55 @@ For quicker hot swapping or if the above does not work, you can install [Single
Minimized, for your convenience -> **Release Types** -> -> Right now we can create Full Releases, Pre Releases and Hotfixes. -> -> - A Full Release is sent to all users, regardless of update stream. -> - A Pre Release is only sent to users who have opted into receiving beta updates. -> - A Hotfix is only sent to users who have *not* opted into receiving beta updates. -> - Therefore, when a bug is fixed in a hotfix update, it should *also* be fixed in a separate prerelease update. -> On the other hand, not all bugs fixed in a prerelease update need to be also dispatched in a hotfix. - -### Creating a new Full Release - -> Full Releases should be bug free, feature complete, and ideally checked by not only the community, but also by Moulberry himself, if he so desires. - -- Edit `NotEnoughUpdates.java` and change - -```java -public static final String VERSION = "2.2.0-REL"; /* Update the VERSION name */ -public static final int VERSION_ID = 20200; /* Set the VERSION_ID to match the version name like so: MAJOR * 10000 + MINOR * 100 + PATCH */ -public static final int PRE_VERSION_ID = 0; /* Reset the PRE_VERSION_ID back to 0 */ -public static final int HOTFIX_VERSION_ID = 0; /* Reset the HOTFIX_VERSION_ID back to 0 */ -``` +### Preparing a release -- Build a jar from this, either using the CI in GitHub actions, or using `gradle remapJar` directly. - - If building locally, make sure that all your changes are in version control so that the commit hash is set correctly (A non `dirty` jar) -- Create a GitHub release (marked as full release). This should also simultaneously create a tag on which to base future hotfixes. -- Edit the `update.json` in the repository and change - -```json5 -{ - "version": "2.1.0-REL", /* Update to match the VERSION name in java */ - "version_id": 20100, /* Update to match the VERSION_ID in java */ - "update_msg": "§7§m§l--------------------§6§l[§c§lNEU§6§l]§7§m§l--------------------\n\n§7A new version, v§6{version}§7, is now available!\n ", /* Update the version name. Remove old patch notes; Optionally add in a short new patch note. */ - "pre_version": "0.0", /* Reset to 0.0 */ - "pre_version_id": 0, /* Reset to 0 */ - "update_link": "https://github.com/NotEnoughUpdates/NotEnoughUpdates/releases/tag/", /* Change download link to the GitHub release */ - "update_direct": "https://github.com/NotEnoughUpdates/NotEnoughUpdates/releases/download//NotEnoughUpdates-.jar", /* Change direct link to a direct download link */ -} -``` +To prepare a release, first merge all the PRs that you want, and then tag that resulting merge commit using `git tag `. +Do *not* use a `vX.X.X` prefix, just raw-dog the `X.X.X` version. If you want this to be a pre-release set the patch version +to something `!= 0`. Note that we follow normal semver rules here, so `3.1.1 > 3.1.0`. -- Launch the game in an older version with this new repo locally to test the messages look first, then push to the central NEU repo (both `master` and `dangerous`) -- Create an announcement in discord [#neu-download](https://discord.com/channels/516977525906341928/693586404256645231). +GitHub actions will automatically build a JAR and generate a changelog and upload both to a draft release. Now you rally +the troups and get your fellow contributors to sign this JAR. -### Creating a pre-release +### Signing a release -> Pre-releases are intended to be mostly feature complete, mostly bug free releases that either don't have enough changes to justify a new Full Release, or have outstanding PRs that are probably merged soon. +The generated draft release should contain a sha256 hash sum. Copy that hash sum for later. -- Edit `NotEnoughUpdates.java` and change +Make sure you have [generated a key](#generating-a-key). -```java -public static final String VERSION = "2.2.0-REL"; /* The VERSION name should still be the same as the latest previously released FULL release */ -public static final int VERSION_ID = 20200; /* Same as VERSION name */ -public static final int PRE_VERSION_ID = 1; /* Increment the PRE_VERSION_ID */ -``` +Run `./gradlew signRelease`. Paste in the sha256 hash from earlier. It will generate a `.asc` signature for every +`secret/` you have. -- Build a jar from this, either using the CI in GitHub actions, or using `gradle remapJar` directly. - - If building locally, make sure that all your changes are in version control so that the commit hash is set correctly (A non `dirty` jar) -- Create a GitHub release (marked as pre-release) -- Edit the `update.json` in the repository and change - -```json5 -{ - "version": "2.1.0-REL", /* The VERSION name should still be the same as the latest previously released FULL release */ - "version_id": 20100, /* Same as VERSION name */ - "pre_update_msg": "§7§m§l--------------------§5§l[§c§lNEU§5§l]§7§m§l--------------------\n\n§7A new pre-release, v§52.0-PRE{pre_version}§7, is now available!\n ", /* Update the version name. Remove old patch notes; Optionally add in a short new patch note. */ - "pre_version": "0.0", /* Set to a new string (preferably increase the major version every time, except for hotfixes on the prerelease stream) */ - "pre_version_id": 0, /* Set to PRE_VERSION_ID from java */ - "pre_update_link": "https://github.com/NotEnoughUpdates/NotEnoughUpdates/releases/tag/", /* Change download link to the GitHub release */ - "pre_update_direct": "https://github.com/NotEnoughUpdates/NotEnoughUpdates/releases/download//NotEnoughUpdates-.jar", /* Change direct link to a direct download link */ -} -``` +Copy those secrets into the draft release. -- Launch the game in an older version with this new repo locally to test the messages look first, then push to the central NEU repo (both `master` and `dangerous`, as some prerelease people sadly don't know how to change repo branches) -- Create an announcement in discord [#unofficial-prereleases](https://discord.com/channels/516977525906341928/837679819487313971). +### Publishing a release -### Creating a Hotfix +Once all relevant personnel have signed off on the release, the release can be published. It should be automatically +available to all people with an auto updater, and be automatically published on modrinth too. The release needs to be +manually uploaded to discord. -> Hotfixes spring off of a Full Release and intend to fix bugs and security flaws. They can, but ideally shouldn't, contain features from pre-releases and are intended as a drop in replacement of the current full release of NEU. These bug fixes should ideally also be released as a pre-release in tandem with the hotfix. +### Generating a key -- Edit `NotEnoughUpdates.java` and change +If you haven't generated a key yet, and you have been told to get one, this is how. -```java -public static final String VERSION = "2.2.0-REL"; /* The VERSION name should still be the same as the latest previously released FULL release */ -public static final int VERSION_ID = 20200; /* Same as VERSION name */ -public static final int PRE_VERSION_ID = 0; /* The PRE_VERSION_ID should still be 0 (as this is based off a full release) */ -public static final int HOTFIX_VERSION_ID = 1; /* Increment the HOTFIX_VERSION_ID */ -``` +For your first key generation, you will need to use openssl. -- Build a jar from this, either using the CI in GitHub actions, or using `gradle remapJar` directly. - - If building locally, make sure that all your changes are in version control so that the commit hash is set correctly (A non `dirty` jar) -- Create a GitHub release (marked as full release) -- Edit the previous FULL release on GitHub with a link to the new release. -- Edit the `update.json` in the repository and change - -```json5 -{ - "version": "2.1.0-REL", /* This version should still remain the same as the last full release */ - "version_id": 20100, /* Same as version */ - "update_msg": "§7§m§l--------------------§6§l[§c§lNEU§6§l]§7§m§l--------------------\n\n§7A new version, v§6{version}§7, is now available!\n ", /* Update the version name. Don't remove old patch notes; Optionally add in a short new patch note. Indicate that there is a hotfix present */ - "update_link": "https://github.com/NotEnoughUpdates/NotEnoughUpdates/releases/tag/", /* Change download link to the GitHub release */ - "update_direct": "https://github.com/NotEnoughUpdates/NotEnoughUpdates/releases/download//NotEnoughUpdates-.jar", /* Change direct link to a direct download link */ -} +```bash +# Generate an RSA private key +openssl genpkey -out id_rsa.pem -algorithm RSA # This step can be skipped, if you want to re-use an existing *RSA* key. + +# Convert your RSA key to pkcs8, without a password protection +openssl pkcs8 -in id_rsa.pem -outform DER -out myname.der -topk8 -nocrypt + +# Generate a public key from your pkcs8 private key +openssl rsa -pubout -in id_rsa.pem -outform der -out myname.key ``` -- Launch the game in an older version with this new repo locally to test the messages look first, then push to the central NEU repo (both `master` and `dangerous`) -- Create an announcement in discord [#neu-download](https://discord.com/channels/516977525906341928/693586404256645231). +Now you have 3 files: + +- `id_rsa.pem` is your base private key. Store it safely somewhere else (maybe on a USB stick). Never share this one. +- `myname.der` is your secret. Put it in the `secrets/` folder in your NEU repo. Never share this one. +- `myname.key` is your public key. Put it in the `src/main/resources/trusted_team_members` folder. + +Make sure that the names of the `.der` and the `.key` file match. +
-- cgit