aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternDump.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2023-11-18 06:06:18 +0100
committerLinnea Gräf <nea@nea.moe>2023-12-04 20:46:40 +0100
commitac14fe8fe04c44e2e08fa90b5cc8fdce293c2ab1 (patch)
tree79a72c3593d4e0304419c259559b371f12bd5249 /src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternDump.kt
parentd9a1a8dda967f40bd4a7a2707bf3ff5411093e7d (diff)
downloadSkyHanni-repopatterns.tar.gz
SkyHanni-repopatterns.tar.bz2
SkyHanni-repopatterns.zip
Add RepoPatternsrepopatterns
RepoPatterns allow us to easily update regexes without creating a new release.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternDump.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternDump.kt30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternDump.kt b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternDump.kt
new file mode 100644
index 000000000..6cacb9a53
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPatternDump.kt
@@ -0,0 +1,30 @@
+package at.hannibal2.skyhanni.utils.repopatterns
+
+import at.hannibal2.skyhanni.utils.KSerializable
+
+/**
+ * A class containing a dump of all regexes that are defined using [RepoPattern].
+ *
+ * # Generating a dump
+ * This dump is generated by the `.github/workflows/generate-constants.yaml` using the gradle task `generateRepoPatterns`.
+ * Said gradle task then launches Minecraft headless with environment variables set so that [RepoPatternManager.onPreInitFinished]
+ * calls [RepoPatternManager.dump] and closes afterward. The GitHub action then looks at the current branch and repo,
+ * and if it finds itself to be running on hannibal002/SkyHanni:beta, it commits that generated dump to the SkyHanni REPO.
+ *
+ * # Using the dump
+ * All clients upon launching will then look at that dump generated by the latest beta version, even if they themselves
+ * run an older SkyHanni version. The regexes generated by the dump will then take precedence over the ones found in the
+ * running JAR.
+ *
+ * # Setting up the `generate-constants.yaml` workflow
+ * The GitHub action workflow needs to be configured properly. For that it needs to have the
+ * `env.data_repo` key adjusted to be the live repo.
+ * It also needs a [repository GitHub action secret](https://github.com/nea89o/SkyHanni/settings/secrets/actions)
+ * called `REPO_PAT`, which contains a [personal access token](https://github.com/settings/tokens/new) with repo write
+ * access to the live repo.
+ */
+@KSerializable
+data class RepoPatternDump(
+ val sourceLabel: String = "anonymous",
+ val regexes: Map<String, String> = mapOf(),
+)