Skip to content

Commit 2d4099c

Browse files
committed
move changelog to markdown and set up a discord webhook for releases
1 parent 8ba8fcd commit 2d4099c

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

.github/workflows/gradle-publish.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ jobs:
7777
build/changelog.html
7878
7979
- name: GH Release
80+
id: gh_release
8081
uses: softprops/action-gh-release@v1
8182
with:
8283
files: build/libs/!(MekanismDefense*).jar
83-
body_path: build/changelog.html
84+
body_path: build/changelog.md
8485
tag_name: v${{ steps.gradle_props.outputs.minecraft_version }}-${{ steps.gradle_props.outputs.mod_version }}.${{ github.run_number }}
8586
target_commitish: ${{ github.sha }}
8687

@@ -96,4 +97,21 @@ jobs:
9697
MEK_MAVEN_PW: ${{ secrets.MEK_MAVEN_PW }}
9798
BUILD_NUMBER: ${{ github.run_number }}
9899
GIT_COMMIT: ${{ github.sha }}
99-
GIT_PREVIOUS_SUCCESSFUL_COMMIT: ${{ steps.last_success_build.outputs.sha != github.sha && steps.last_success_build.outputs.sha || steps.last_success_build_any.outputs.sha }}
100+
GIT_PREVIOUS_SUCCESSFUL_COMMIT: ${{ steps.last_success_build.outputs.sha != github.sha && steps.last_success_build.outputs.sha || steps.last_success_build_any.outputs.sha }}
101+
102+
- name: Read changelog
103+
id: read_changelog
104+
uses: andstor/file-reader-action@v1
105+
with:
106+
path: "build/changelog.md"
107+
108+
- name: Announce Release
109+
uses: tsickert/discord-webhook@v6.0.0
110+
with:
111+
webhook-url: ${{ secrets.WEBHOOK_URL }}
112+
embed-title: Mekanism ${{ steps.gradle_props.outputs.mod_version }}.${{ github.run_number }} for Minecraft ${{ steps.gradle_props.outputs.minecraft_version }} Released
113+
embed-url: ${{ steps.gh_release.outputs.url }}
114+
embed-description: |
115+
Available on Curseforge after approval.
116+
117+
${{ steps.read_changelog.outputs.contents }}

build.gradle

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -687,30 +687,30 @@ def changeLogResolver = { ->
687687
if (!message.startsWith("Merge branch") && !message.startsWith("Merge pull request") && !message.contains("[no-changelog]")) {
688688
//Ignore Merges and PR Merges
689689
message = message.replaceAll("#(\\d+)", { match ->//turn issues/prs into links (github currently supports prs being linked as issues)
690-
return "<a href=\"https://github.com/mekanism/Mekanism/issues/${match[1]}\">${match[0]}</a>"
691-
}).replaceAll("\\n", "<br>&emsp;")//convert new lines that are part of a commit message into actual new lines and a tab
690+
return "[${match[0]}](https://github.com/mekanism/Mekanism/issues/${match[1]})"
691+
}).replaceAll("\\n", " \n\t")//convert new lines that are part of a commit message into new lines and a tab
692692
if (generatedChangelog != "") {
693693
//If this isn't the first commit prepend an extra newline
694-
generatedChangelog += "<br>"
694+
generatedChangelog += " \n"
695695
}
696-
generatedChangelog += "<a href=\"https://github.com/mekanism/Mekanism/commit/${commit.id}\">${commit.getAbbreviatedId()}</a> - ${message}"
696+
generatedChangelog += "[${commit.getAbbreviatedId()}](https://github.com/mekanism/Mekanism/commit/${commit.id}) - ${message}"
697697
}
698698
}
699699
println "Changelog generated"
700700
}
701701

702-
def releaseNotesFile = project.file("docs/release_${mod_version}.html")
702+
def releaseNotesFile = project.file("docs/release_${mod_version}.md")
703703
if (releaseNotesFile.exists()) {
704704
//Add any version specific changelog stuff
705705
def releaseNotes = releaseNotesFile.getText()
706-
generatedChangelog = "$releaseNotes<br> $generatedChangelog"
706+
generatedChangelog = "$releaseNotes\n\n $generatedChangelog"
707707
}
708708

709709
if (release_type == "alpha") {
710710
//Add a warning at the top about what an alpha build means
711711
generatedChangelog = "Warning: Mekanism is currently in alpha, and is not recommended for widespread use in modpacks. There are likely to be game breaking bugs, " +
712712
"and updating from one alpha to the next may cause various mekanism blocks to disappear/void their contents. While we will try to not have this happen/keep " +
713-
"it to a minimum make sure to make backups. You can read more about the alpha state of this project <a href=\"https://github.com/mekanism/Mekanism#alpha-status\">here</a>." +
713+
"it to a minimum make sure to make backups. You can read more about the alpha state of this project [here](https://github.com/mekanism/Mekanism#alpha-status)." +
714714
"<br> $generatedChangelog"
715715
}
716716
resolvedChangelog = generatedChangelog
@@ -719,7 +719,7 @@ def changeLogResolver = { ->
719719

720720
tasks.register('outputChangelog') {
721721
doLast {
722-
project.file("build/changelog.html").text = changeLogResolver.call()
722+
project.file("build/changelog.md").text = changeLogResolver.call()
723723
}
724724
}
725725

@@ -777,7 +777,7 @@ if (System.getenv("CURSEFORGE_KEY") != null || project.hasProperty('curseforgeKe
777777

778778
void setGenericCurseArtifactData(UploadArtifact artifact, String changelog) {
779779
artifact.changelog = changelog
780-
artifact.changelogType = 'html'
780+
artifact.changelogType = 'markdown'
781781
artifact.releaseType = "${release_type}"
782782
}
783783

0 commit comments

Comments
 (0)