mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-22 02:25:49 +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:
|
jobs:
|
||||||
release-please:
|
release-please:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
environment: release
|
||||||
outputs:
|
outputs:
|
||||||
release_created: ${{ steps.release.outputs.release_created }}
|
release_created: ${{ steps.release.outputs.release_created }}
|
||||||
upload_url: ${{ steps.release.outputs.upload_url }}
|
upload_url: ${{ steps.release.outputs.upload_url }}
|
||||||
@ -28,6 +29,7 @@ jobs:
|
|||||||
release-task: [curseforge, discordupload, modrinth]
|
release-task: [curseforge, discordupload, modrinth]
|
||||||
needs: release-please
|
needs: release-please
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
environment: release
|
||||||
if: ${{ needs.release-please.outputs.release_created }}
|
if: ${{ needs.release-please.outputs.release_created }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- 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 }}
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
run: |
|
run: |
|
||||||
# Build
|
# Build
|
||||||
./gradlew build
|
./gradlew build discordupload
|
||||||
|
@ -51,6 +51,12 @@ allprojects {
|
|||||||
|
|
||||||
apply from: 'env-variables.gradle'
|
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"
|
archivesBaseName = "Advanced-Portals"
|
||||||
group = 'com.sekwah.advancedportals'
|
group = 'com.sekwah.advancedportals'
|
||||||
def versionString = (file('./version.txt').text + (isRelease ? "" : "-${snapshotName}${shaRef}")).replaceAll('\n', '').replaceAll('\r', '')
|
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 {
|
task curseforge {
|
||||||
dependsOn(jar)
|
dependsOn(jar)
|
||||||
doLast {
|
doLast {
|
||||||
String apiKey = null
|
String apiKey = System.getenv("CURSE_API")
|
||||||
|
|
||||||
if (System.getenv("CURSE_API") != null) {
|
|
||||||
apiKey = System.getenv("CURSE_API")
|
|
||||||
}
|
|
||||||
|
|
||||||
if(apiKey != null) {
|
if(apiKey != null) {
|
||||||
|
|
||||||
@ -134,6 +130,21 @@ task curseforge {
|
|||||||
def versions = gameVersions.findAll {it.gameVersionTypeID == gameVersionTypeID}
|
def versions = gameVersions.findAll {it.gameVersionTypeID == gameVersionTypeID}
|
||||||
|
|
||||||
String[] supportedVersions = [
|
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.18",
|
||||||
"1.17",
|
"1.17",
|
||||||
"1.16",
|
"1.16",
|
||||||
|
@ -17,14 +17,17 @@ buildscript {
|
|||||||
|
|
||||||
apply from: 'env-variables.gradle'
|
apply from: 'env-variables.gradle'
|
||||||
|
|
||||||
/** For pre-releases and testers to be able to try the latest commits if they want.
|
def getReleaseChangelog() {
|
||||||
* If the builds start exceeding 8MB then we may want to upload to s3 instead and periodically clear.
|
def changelogFile = file('CHANGELOG.md')
|
||||||
* TODO possibly add a task that announces when builds are made?
|
def changelog = "## [${changelogFile.text.split('\n## \\[')[1]}\n\n"// ${project.github}/blob/${branch}/CHANGELOG.md
|
||||||
* Though add a note that it may take a while for Curse to approve the files.
|
return changelog;
|
||||||
*/
|
}
|
||||||
|
|
||||||
task discordupload {
|
task discordupload {
|
||||||
dependsOn(jar)
|
dependsOn(jar)
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
|
|
||||||
String discordWebhook = System.getenv("DISCORD_WEBHOOK")
|
String discordWebhook = System.getenv("DISCORD_WEBHOOK")
|
||||||
|
|
||||||
if(discordWebhook != null) {
|
if(discordWebhook != null) {
|
||||||
@ -34,8 +37,26 @@ task discordupload {
|
|||||||
HttpPost uploadFile = new HttpPost(discordWebhook)
|
HttpPost uploadFile = new HttpPost(discordWebhook)
|
||||||
|
|
||||||
MultipartEntityBuilder builder = MultipartEntityBuilder.create()
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create()
|
||||||
builder.addTextBody("content", "New automated dev build\n\n" +
|
if(!isRelease) {
|
||||||
"Current Features: <${project.github}/blob/${ext.githubSha}/docs/changelogs/SNAPSHOT_CHANGELOG.md>")
|
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)
|
builder.addBinaryBody("file", file(jar.archiveFile).newInputStream(), ContentType.APPLICATION_OCTET_STREAM, jar.archiveName)
|
||||||
|
|
||||||
@ -48,7 +69,7 @@ task discordupload {
|
|||||||
println("Posted build")
|
println("Posted build")
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
println("Discord webhook unspecified ${sha}")
|
println("Discord webhook unspecified")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user