Skip to content
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

chore: release files extra fixes #475

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changelog

## [1.0.0](https://github.com/sekwah41/Advanced-Portals/compare/v0.11.0...v1.0.0) (2024-12-09)

**This is not the re-code, I released some breaking config changes for servers that used to rely on the automatic proxy detection.**

### 💥 Breaking Change

- fix!: disable proxy detection to avoid vulnerabilities (see full commit for more info) [#436](https://github.com/sekwah41/Advanced-Portals/pull/436) ([@sekwah41](https://github.com/sekwah41))
- fix: stop portal packets still being forwarded to the client [#436](https://github.com/sekwah41/Advanced-Portals/pull/436) ([@sekwah41](https://github.com/sekwah41))

### Authors: 1

- Sekwah ([@sekwah41](https://github.com/sekwah41))
53 changes: 53 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ buildscript {


plugins {
id "com.modrinth.minotaur" version "2.+"
id 'dev.s7a.gradle.minecraft.server' version '1.1.0'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7'
}
Expand Down Expand Up @@ -51,6 +52,7 @@ allprojects {


apply from: 'env-variables.gradle'
apply from: 'changelog-util.gradle'


println("Branch ${ext.branch}${ext.shaRef} isRelease: '${ext.isRelease}'")
Expand Down Expand Up @@ -195,5 +197,56 @@ idea {
}
}

modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = project.modrinth_slug
versionType = "release"
uploadFile = jar
loaders = ["spigot"]
gameVersions = [
"1.13",
"1.13.1",
"1.13.2",
"1.14",
"1.14.1",
"1.14.2",
"1.14.3",
"1.14.4",
"1.15",
"1.15.1",
"1.15.2",
"1.16",
"1.16.1",
"1.16.2",
"1.16.3",
"1.16.4",
"1.16.5",
"1.17",
"1.17.1",
"1.18",
"1.18.1",
"1.18.2",
"1.19",
"1.19.1",
"1.19.2",
"1.19.3",
"1.19.4",
"1.20",
"1.20.1",
"1.20.2",
"1.20.3",
"1.20.4",
"1.20.5",
"1.20.6",
"1.21",
"1.21.1",
"1.21.2",
"1.21.3",
"1.21.4"
]
changelog = getReleaseChangelog()
}


apply from: 'curse.gradle'
apply from: 'discord.gradle'
5 changes: 5 additions & 0 deletions changelog-util.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ext.getReleaseChangelog = {
def changelogFile = file('CHANGELOG.md')
def changelog = "## [${changelogFile.text.split('\n## \\[')[1]}\n\n" // ${project.github}/blob/${branch}/CHANGELOG.md
return changelog
}
36 changes: 18 additions & 18 deletions discord.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,16 @@ buildscript {
}

apply from: 'env-variables.gradle'

def getReleaseChangelog() {
def changelogFile = file('CHANGELOG.md')
def changelog = "## [${changelogFile.text.split('\n## \\[')[1]}\n\n"// ${project.github}/blob/${branch}/CHANGELOG.md
return changelog;
}
apply from: 'changelog-util.gradle'

task discordupload {
dependsOn(jar)

doLast {

String discordWebhook = System.getenv("DISCORD_WEBHOOK")
String discordWebhook = isRelease ? System.getenv("DISCORD_RELEASE_WEBHOOK") : System.getenv("DISCORD_WEBHOOK")

if(discordWebhook != null) {
println("Logging Into Discord")

CloseableHttpClient httpClient = HttpClients.createDefault()
HttpPost uploadFile = new HttpPost(discordWebhook)
Expand All @@ -42,20 +36,22 @@ task discordupload {
} else {
def maxLength = 2000

def content = "New release build\n" +
"```markdown\n" +
"${getReleaseChangelog()}\n" +
"```"
def content = "# New release build\n" +
"${getReleaseChangelog()}\n"

if (content.length() > maxLength) {
def trimmedChangelog = getReleaseChangelog().take(maxLength - 15) // Reserve space for ending message
content = "New release build\n" +
"```markdown\n" +
"${trimmedChangelog}\n" +
"``` [Truncated]"
def afterMessage = "[See more on GitHub](https://github.com/sekwah41/Advanced-Portals/releases)"

def truncatedContent = content.take(maxLength - afterMessage.length() - 1)
def lastFullLine = truncatedContent.lastIndexOf("\n")
content = "${truncatedContent.take(lastFullLine)}\n" +
"${afterMessage}"

}

builder.addTextBody("content", content)
content = content.replaceAll(/(http[s]?:\/\/[^\s)]+)/, '<$1>')

builder.addTextBody("content", content, ContentType.create("text/plain", "UTF-8"))
}

builder.addBinaryBody("file", file(jar.archiveFile).newInputStream(), ContentType.APPLICATION_OCTET_STREAM, jar.archiveName)
Expand All @@ -66,6 +62,10 @@ task discordupload {
CloseableHttpResponse response = httpClient.execute(uploadFile)
response.getEntity()

if(response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("Failed to post build to discord")
}

println("Posted build")

} else {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ version=1.0.0

github=https://github.com/sekwah41/Advanced-Portals
curse_project_id=86001
modrinth_slug=advanced-portals
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ include 'spigot'
// Proxies
include 'velocity'
include 'bungee'

Loading