@@ -40,12 +40,77 @@ jobs:
4040 commit_count=$(git log | grep -e '^commit [a-zA-Z0-9]*' | wc -l)
4141 echo "short_sha=$short_sha" >> $GITHUB_OUTPUT
4242 echo "commit_count=$commit_count" >> $GITHUB_OUTPUT
43+ - name : Get github release information
44+ if : ${{ github.event_name == 'workflow_dispatch' }}
45+ id : get_release
46+ uses : cardinalby/git-get-release-action@1.2.4
47+ env :
48+ GITHUB_TOKEN : ${{ github.token }}
49+ with :
50+ tag : ${{ github.event.inputs.publish_target_release_tag }}
4351 - name : Read Properties mod info
4452 id : mod_info
4553 uses : christian-draeger/read-properties@1.1.1
4654 with :
4755 path : gradle.properties
4856 properties : ' mod.name mod.version'
57+ - name : Prepare file information
58+ id : file_info
59+ run : |
60+ shopt -s extglob
61+ FILE_PATHS=$(ls ${{ format('build-artifacts/magiclib-wrapper/{0}/{1}/build/libs/!(*-@(dev|sources|shadow|javadoc|empty)).jar', inputs.publish_platform, inputs.publish_mc_ver) }})
62+
63+ if (( ${#FILE_PATHS[@]} != 1 )); then
64+ echo "Error: Found ${#FILE_PATHS[@]} files, expected exactly 1"
65+ exit 1
66+ else
67+ FILE_PATH=${FILE_PATHS[0]}
68+ fi
69+
70+ FILE_NAME=$(basename $FILE_PATH)
71+ FILE_HASH=$(sha256sum $FILE_PATH | awk '{ print $1 }')
72+ echo "path=$FILE_PATH" >> $GITHUB_OUTPUT
73+ echo "name=$FILE_NAME" >> $GITHUB_OUTPUT
74+ echo "hash=$FILE_HASH" >> $GITHUB_OUTPUT
75+ cat $GITHUB_OUTPUT
76+ - name : Prepare changelog (Dev Channel)
77+ if : ${{ inputs.publish_channel == 'dev' }}
78+ uses : actions/github-script@v6
79+ id : changelog_dev
80+ with :
81+ script : return process.env.CHANGELOG
82+ result-encoding : string
83+ env :
84+ CHANGELOG : |-
85+ **This version is automatically released by CI Build**
86+ Latest commit log:
87+ ${{ github.event.head_commit.message }}
88+
89+ -------
90+
91+ Build Information
92+
93+ - File name: `${{ steps.file_info.outputs.name }}`
94+ - SHA-256: `${{ steps.file_info.outputs.hash }}`
95+ - Built from: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
96+ - name : Prepare changelog (Stable Channel)
97+ if : ${{ inputs.publish_channel == 'stable' }}
98+ uses : actions/github-script@v6
99+ id : changelog_release
100+ with :
101+ script : return process.env.CHANGELOG
102+ result-encoding : string
103+ env :
104+ CHANGELOG : |-
105+ ${{ format('{0}{1}', github.event.release.body, steps.get_release.outputs.body) }}
106+
107+ -------
108+
109+ Build Information
110+
111+ - File name: `${{ steps.file_info.outputs.name }}`
112+ - SHA-256: `${{ steps.file_info.outputs.hash }}`
113+ - Built from: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
49114 - name : Publish Minecraft Mods (Dev Channel)
50115 if : ${{ inputs.publish_channel == 'dev' }}
51116 uses : Kir-Antipov/mc-publish@v3.3
@@ -70,10 +135,8 @@ jobs:
70135 name : ' [CI#${{ github.run_number }}]${{ steps.mod_info.outputs.mod-name }} ${{ steps.mod_info.outputs.mod-version }}.${{ steps.get_git_info.outputs.commit_count }}+${{ steps.get_git_info.outputs.short_sha }}'
71136 version : ${{ steps.mod_info.outputs.mod-version }}.${{ steps.get_git_info.outputs.commit_count }}+${{ steps.get_git_info.outputs.short_sha }}
72137 version-type : alpha
73- changelog : |
74- **This version is automatically released by CI Build**
75- Latest commit log:
76- ${{ github.event.head_commit.message }}
138+ modrinth-changelog : ${{ steps.changelog_dev.outputs.result }}
139+ curseforge-changelog : ${{ steps.changelog_dev.outputs.result }}
77140 loaders : |
78141 ${{ inputs.publish_platform }}
79142 game-versions : |
@@ -107,7 +170,9 @@ jobs:
107170 name : ' ${{ steps.mod_info.outputs.mod-name }} ${{ steps.mod_info.outputs.mod-version }}.${{ steps.get_git_info.outputs.commit_count }}+${{ steps.get_git_info.outputs.short_sha }}'
108171 version : ${{ steps.mod_info.outputs.mod-version }}.${{ steps.get_git_info.outputs.commit_count }}
109172 version-type : release
110- changelog : ${{ github.event.release.body }}
173+ github-changelog : ${{ format('{0}{1}', github.event.release.body, steps.get_release.outputs.body) }}
174+ modrinth-changelog : ${{ steps.changelog.outputs.result }}
175+ curseforge-changelog : ${{ steps.changelog.outputs.result }}
111176 loaders : |
112177 ${{ inputs.publish_platform }}
113178 game-versions : |
0 commit comments