1
- name : Build and Release (Manual Run)v1.4
1
+ name : Build and Release (Manual Run) v1.3
2
2
3
3
on :
4
4
workflow_dispatch : # This event allows manual triggering
@@ -13,12 +13,14 @@ jobs:
13
13
with :
14
14
fetch-depth : 0
15
15
16
+
16
17
- name : Set up JDK 17
17
18
uses : actions/setup-java@v3
18
19
with :
19
20
java-version : 17
20
21
distribution : ' temurin'
21
22
23
+
22
24
- name : Set Extensions Dir
23
25
id : set_ext_dir
24
26
run : |
@@ -101,7 +103,9 @@ jobs:
101
103
zip -r /tmp/to/${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip *.jar
102
104
cd ${{env.CURRENT}}
103
105
104
- - name: Create Release
106
+
107
+
108
+ - name : Create Release
105
109
id : create_release
106
110
uses : actions/github-script@v6
107
111
with :
@@ -112,14 +116,14 @@ jobs:
112
116
var tag = '' + `${{ steps.set_tag.outputs.tag }}`;
113
117
const archivePath = '/tmp/to/${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip';
114
118
var response = await github.rest.repos.createRelease({
115
- draft: false,
116
- generate_release_notes: true,
117
- name: tag,
118
- owner: context.repo.owner,
119
- prerelease: false,
120
- repo: context.repo.repo,
121
- tag_name: tag,
122
- body: changelog
119
+ draft:false,
120
+ generate_release_notes:true,
121
+ name:tag,
122
+ owner:context.repo.owner,
123
+ prerelease:false,
124
+ repo:context.repo.repo,
125
+ tag_name:tag,
126
+ body:changelog
123
127
});
124
128
125
129
core.exportVariable('RELEASE_ID', response.data.id);
@@ -128,7 +132,6 @@ jobs:
128
132
} catch (error) {
129
133
core.setFailed(error.message);
130
134
}
131
-
132
135
- name : Upload Release Artifacts
133
136
uses : actions/upload-release-asset@v1
134
137
env :
@@ -138,7 +141,44 @@ jobs:
138
141
asset_name : ${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip
139
142
upload_url : ${{ env.RELEASE_UPLOAD_URL }}
140
143
asset_content_type : application/zip
144
+
145
+ - name : " Generate release changelog"
146
+ id : github_changelog
147
+ uses : Helmisek/conventional-changelog-generator@v1.0.6-release
148
+ with :
149
+ repo-token : ${{ secrets.GITHUB_TOKEN }}
150
+ commit-types : " fix:Bug Fixes,feat:Features,doc:Documentation,build:Build Upgrades,BREAKING CHANGE:Enhancements"
151
+ template-path : " .github/workflows/CHANGELOG.tpl.md"
152
+
153
+
154
+ - name : update CHANGELOG.md
155
+ run : |
156
+ # Content to add at the top
157
+ # Get the current date in YYYY-MM-DD format
158
+ release_date=$(date +"%Y-%m-%d")
159
+ version="## Version: [${{env.RELEASE_VERSION}}](${{ env.RELEASE_URL }}) | Created: $release_date"
160
+ content="$version${{steps.github_changelog.outputs.changelog}}"
161
+
162
+ # Existing file
163
+ file="CHANGELOG.md"
141
164
165
+ # Create a temporary file with the content at the top and existing content below
166
+
167
+ echo "$content" > temp_file.txt
168
+ cat "$file" >> temp_file.txt
169
+
170
+ # Overwrite the original file with the updated content
171
+ mv temp_file.txt "$file"
172
+
173
+ # Commit the updated CHANGELOG.md file
174
+ git add CHANGELOG.md
175
+ git config --local user.email "action@github.com"
176
+ git config --local user.name "GitHub Action"
177
+ git commit -m "Update Changelog for Release [skip ci]"
178
+
179
+ # Push the changes to the remote repository
180
+ git push --quiet --set-upstream origin HEAD
181
+
142
182
- name : Get Compare URL
143
183
run : |
144
184
compare=$(echo ${{ env.RELEASE_URL }} | sed 's/releases\/tag.*/compare/')
@@ -152,18 +192,20 @@ jobs:
152
192
github-token : ${{ secrets.GITHUB_TOKEN }}
153
193
script : |
154
194
try {
155
- var changelog = `${{env.COMPAREURL}}`;
195
+
196
+
197
+ var changelog = `${{steps.github_changelog.outputs.changelog}}` + `${{env.COMPAREURL}}` ;
156
198
var release_id = `${{env.RELEASE_ID}}`;
157
199
var tag = '' + `${{ steps.set_tag.outputs.tag }}`;
158
200
const archivePath = '/tmp/to/${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip';
159
201
var _response = await github.rest.repos.updateRelease({
160
- draft: false,
161
- generate_release_notes: true,
162
- owner: context.repo.owner,
202
+ draft:false,
203
+ generate_release_notes:true,
204
+ owner:context.repo.owner,
163
205
repo: context.repo.repo,
164
- prerelease: false,
165
- release_id: release_id,
166
- body: changelog
206
+ prerelease:false,
207
+ release_id:release_id,
208
+ body:changelog
167
209
});
168
210
169
211
core.exportVariable('RELEASE_ID', _response.data.id);
0 commit comments