Skip to content

Commit b857001

Browse files
authored
Fix wrong change log processor (#132)
- I hope this is the last time I have to deal with this issue Signed-off-by: Hendrix-Shen <[email protected]>
1 parent 532f15e commit b857001

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

.github/workflows/publish.yml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
contents: write
2020
outputs:
2121
commit_count: ${{ steps.shared_publish_info.outputs.commit_count }}
22-
github_changelog: ${{ steps.shared_publish_info.outputs.github_changelog }}
22+
github_changelog: ${{ steps.changelog.outputs.result }}
2323
github_tag: ${{ steps.shared_publish_info.outputs.github_tag }}
2424
mod_name: ${{ steps.shared_publish_info.outputs.mod_name }}
2525
mod_version: ${{ steps.shared_publish_info.outputs.mod_version }}
@@ -55,7 +55,6 @@ jobs:
5555
5656
if [ "${{ inputs.publish_type }}" == 'release' ]
5757
then
58-
github_changelog=$(printf '%q' "${{ github.event.release.body }}")
5958
github_tag=${{ github.event.ref }}
6059
release_title=${{ github.event.release.name }}
6160
elif [ "${{ inputs.publish_type }}" == "dev" ]
@@ -72,34 +71,45 @@ jobs:
7271
github_tag="$REPO_OWNER/${{ github.ref_name }}.$commit_count"
7372
release_title="[CI#${{ github.run_number }}]$mod_name $mod_full_version (Fork)"
7473
fi
75-
76-
github_changelog="**This version is automatically released by CI Build**
77-
78-
Latest commit log:
79-
80-
$(printf '%q' '${{ github.event.head_commit.message }}')"
8174
else
8275
echo Unknown publish type ${{ inputs.publish_type }}
8376
exit 1
8477
fi
8578
8679
echo "short_sha=$short_sha" >> $GITHUB_OUTPUT
87-
echo "github_changelog<<EOF
88-
$github_changelog
89-
EOF" >> "$GITHUB_OUTPUT"
9080
echo "commit_count=$commit_count" >> $GITHUB_OUTPUT
9181
echo "github_tag=$github_tag" >> $GITHUB_OUTPUT
9282
echo "mod_name=$mod_name" >> $GITHUB_OUTPUT
9383
echo "mod_version=$mod_version" >> $GITHUB_OUTPUT
9484
echo "mod_full_version=$mod_full_version" >> $GITHUB_OUTPUT
9585
echo "release_title=$release_title" >> $GITHUB_OUTPUT
86+
- name: Prepare changelog
87+
uses: actions/github-script@v7
88+
id: changelog
89+
with:
90+
script: |
91+
if ('${{ inputs.publish_type }}' === 'release') {
92+
return process.env.CHANGELOG;
93+
} else {
94+
return process.env.CHANGELOG_DEV;
95+
}
96+
result-encoding: string
97+
env:
98+
CHANGELOG: |-
99+
${{ github.event.release.body }}
100+
CHANGELOG_DEV: |-
101+
This version is automatically released by CI Build**
102+
103+
Latest commit log:
104+
105+
${{ github.event.head_commit.message }}
96106
- name: Publish Minecraft Mods (Dev Channel)
97107
if: ${{ inputs.publish_type == 'dev' }}
98108
uses: Kir-Antipov/[email protected]
99109
with:
100110
github-tag: ${{ steps.shared_publish_info.outputs.github_tag }}
101111
github-token: ${{ secrets.GITHUB_TOKEN }}
102-
github-changelog: ${{ steps.shared_publish_info.outputs.github_changelog }}
112+
github-changelog: ${{ steps.changelog.outputs.result }}
103113
github-prerelease: true
104114
files: |
105115
build-artifacts/magiclib-wrapper/fabric/build/tmp/submods/publish/!(*-@(dev|sources|javadoc|empty)).jar
@@ -168,7 +178,7 @@ jobs:
168178
echo "name=$FILE_NAME" >> $GITHUB_OUTPUT
169179
echo "hash=$FILE_HASH" >> $GITHUB_OUTPUT
170180
cat $GITHUB_OUTPUT
171-
- name: Prepare changelog
181+
- name: Attach file info to changelog
172182
uses: actions/github-script@v7
173183
id: changelog
174184
with:

0 commit comments

Comments
 (0)