mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-21 18:16:03 +01:00
chore: switch to using env
BREAKING CHANGE: This is a complete recode, features may be missing or different, if there are issues please open an issue on github or contact us about it on discord.
This commit is contained in:
parent
72290709ff
commit
d672954b4b
2
.github/workflows/release-please.yml
vendored
2
.github/workflows/release-please.yml
vendored
@ -7,6 +7,7 @@ name: release-please
|
||||
jobs:
|
||||
release-please:
|
||||
runs-on: ubuntu-latest
|
||||
environment: release
|
||||
outputs:
|
||||
release_created: ${{ steps.release.outputs.release_created }}
|
||||
upload_url: ${{ steps.release.outputs.upload_url }}
|
||||
@ -28,6 +29,7 @@ jobs:
|
||||
release-task: [curseforge, discordupload, modrinth]
|
||||
needs: release-please
|
||||
runs-on: ubuntu-latest
|
||||
environment: release
|
||||
if: ${{ needs.release-please.outputs.release_created }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
2
.github/workflows/snapshots.yml
vendored
2
.github/workflows/snapshots.yml
vendored
@ -34,4 +34,4 @@ jobs:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
run: |
|
||||
# Build
|
||||
./gradlew build
|
||||
./gradlew build discordupload
|
||||
|
@ -51,6 +51,12 @@ allprojects {
|
||||
|
||||
apply from: 'env-variables.gradle'
|
||||
|
||||
|
||||
println("Branch ${ext.branch}${ext.shaRef} isRelease: '${ext.isRelease}'")
|
||||
println("Snapshot Name: ${ext.snapshotName}")
|
||||
println("Github SHA: ${ext.githubSha}")
|
||||
println("Sha Ref: ${ext.shaRef}")
|
||||
|
||||
archivesBaseName = "Advanced-Portals"
|
||||
group = 'com.sekwah.advancedportals'
|
||||
def versionString = (file('./version.txt').text + (isRelease ? "" : "-${snapshotName}${shaRef}")).replaceAll('\n', '').replaceAll('\r', '')
|
||||
@ -184,3 +190,6 @@ idea {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply from: 'curse.gradle'
|
||||
apply from: 'discord.gradle'
|
||||
|
21
curse.gradle
21
curse.gradle
@ -113,11 +113,7 @@ class UploadResponse {
|
||||
task curseforge {
|
||||
dependsOn(jar)
|
||||
doLast {
|
||||
String apiKey = null
|
||||
|
||||
if (System.getenv("CURSE_API") != null) {
|
||||
apiKey = System.getenv("CURSE_API")
|
||||
}
|
||||
String apiKey = System.getenv("CURSE_API")
|
||||
|
||||
if(apiKey != null) {
|
||||
|
||||
@ -134,6 +130,21 @@ task curseforge {
|
||||
def versions = gameVersions.findAll {it.gameVersionTypeID == gameVersionTypeID}
|
||||
|
||||
String[] supportedVersions = [
|
||||
"1.21",
|
||||
"1.20.6",
|
||||
"1.20.5",
|
||||
"1.20.4",
|
||||
"1.20.3",
|
||||
"1.20.2",
|
||||
"1.20.1",
|
||||
"1.20",
|
||||
"1.19.4",
|
||||
"1.19.3",
|
||||
"1.19.2",
|
||||
"1.19.1",
|
||||
"1.19",
|
||||
"1.18.2",
|
||||
"1.18.1",
|
||||
"1.18",
|
||||
"1.17",
|
||||
"1.16",
|
||||
|
@ -17,14 +17,17 @@ buildscript {
|
||||
|
||||
apply from: 'env-variables.gradle'
|
||||
|
||||
/** For pre-releases and testers to be able to try the latest commits if they want.
|
||||
* If the builds start exceeding 8MB then we may want to upload to s3 instead and periodically clear.
|
||||
* TODO possibly add a task that announces when builds are made?
|
||||
* Though add a note that it may take a while for Curse to approve the files.
|
||||
*/
|
||||
def getReleaseChangelog() {
|
||||
def changelogFile = file('CHANGELOG.md')
|
||||
def changelog = "## [${changelogFile.text.split('\n## \\[')[1]}\n\n"// ${project.github}/blob/${branch}/CHANGELOG.md
|
||||
return changelog;
|
||||
}
|
||||
|
||||
task discordupload {
|
||||
dependsOn(jar)
|
||||
|
||||
doLast {
|
||||
|
||||
String discordWebhook = System.getenv("DISCORD_WEBHOOK")
|
||||
|
||||
if(discordWebhook != null) {
|
||||
@ -34,8 +37,26 @@ task discordupload {
|
||||
HttpPost uploadFile = new HttpPost(discordWebhook)
|
||||
|
||||
MultipartEntityBuilder builder = MultipartEntityBuilder.create()
|
||||
builder.addTextBody("content", "New automated dev build\n\n" +
|
||||
"Current Features: <${project.github}/blob/${ext.githubSha}/docs/changelogs/SNAPSHOT_CHANGELOG.md>")
|
||||
if(!isRelease) {
|
||||
builder.addTextBody("content", "New snapshot or testing build")
|
||||
} else {
|
||||
def maxLength = 2000
|
||||
|
||||
def content = "New release build\n" +
|
||||
"```markdown\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]"
|
||||
}
|
||||
|
||||
builder.addTextBody("content", content)
|
||||
}
|
||||
|
||||
builder.addBinaryBody("file", file(jar.archiveFile).newInputStream(), ContentType.APPLICATION_OCTET_STREAM, jar.archiveName)
|
||||
|
||||
@ -48,7 +69,7 @@ task discordupload {
|
||||
println("Posted build")
|
||||
|
||||
} else {
|
||||
println("Discord webhook unspecified ${sha}")
|
||||
println("Discord webhook unspecified")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user