Skip to content

Commit 76f8be1

Browse files
CI: Use single packaging job, add changelog support (#491)
1 parent 6db8551 commit 76f8be1

File tree

2 files changed

+47
-32
lines changed

2 files changed

+47
-32
lines changed

.github/workflows/vcpkg_ci.yml

+17-32
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,25 @@ jobs:
132132

133133

134134

135-
release_linux:
135+
release_packages:
136136
# Do not run the release procedure if any of the builds has failed
137137
needs: [ build_linux, build_mac ]
138138
runs-on: ubuntu-20.04
139139
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
140140

141141
steps:
142+
- name: Clone the remill repository
143+
uses: actions/checkout@v2
144+
with:
145+
path: remill
146+
fetch-depth: 0
147+
148+
- name: Generate the changelog
149+
shell: bash
150+
working-directory: remill
151+
run: |
152+
./scripts/generate_changelog.sh changelog.md
153+
142154
- name: Download all artifacts
143155
uses: actions/download-artifact@v2
144156

@@ -152,6 +164,7 @@ jobs:
152164
with:
153165
tag_name: ${{ github.ref }}
154166
release_name: Version ${{ github.ref }}
167+
body_path: remill/changelog.md
155168
draft: true
156169
prerelease: true
157170

@@ -163,6 +176,9 @@ jobs:
163176
zip -r9 remill_ubuntu-20.04_packages.zip \
164177
ubuntu-20.04*
165178
179+
zip -r9 remill_macos-10.15_packages.zip \
180+
macos-10.15*
181+
166182
- name: Upload the Ubuntu 18.04 packages
167183
uses: actions/upload-release-asset@v1
168184

@@ -187,37 +203,6 @@ jobs:
187203
asset_name: remill_ubuntu-20.04_packages.zip
188204
asset_content_type: application/gzip
189205

190-
191-
192-
193-
release_macos:
194-
# Do not run the release procedure if any of the builds has failed
195-
needs: [ build_linux, build_mac ]
196-
runs-on: 'macos-10.15'
197-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
198-
199-
steps:
200-
- name: Download all artifacts
201-
uses: actions/download-artifact@v2
202-
203-
- name: Draft the new release
204-
id: create_release
205-
uses: actions/create-release@v1
206-
207-
env:
208-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
209-
210-
with:
211-
tag_name: ${{ github.ref }}
212-
release_name: Version ${{ github.ref }}
213-
draft: true
214-
prerelease: true
215-
216-
- name: Group the packages by platform
217-
run: |
218-
zip -r9 remill_macos-10.15_packages.zip \
219-
macos-10.15*
220-
221206
- name: Upload the macOS 10.15 packages
222207
uses: actions/upload-release-asset@v1
223208

scripts/generate_changelog.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
PROJECT_NAME="remill"
4+
5+
main() {
6+
if [[ $# != 1 ]] ; then
7+
printf "Usage:\n\tgenerate_changelog.sh <path/to/changelog/file.md>\n"
8+
return 1
9+
fi
10+
11+
local output_path="${1}"
12+
local current_version="$(git describe --tags --always)"
13+
local previous_version="$(git describe --tags --always --abbrev=0 ${current_version}^)"
14+
15+
echo "Current version: ${current_version}"
16+
echo "Previous version: ${previous_version}"
17+
echo "Output file: ${output_path}"
18+
19+
printf "# Changelog\n\n" > "${output_path}"
20+
printf "The following are the changes that happened between versions ${previous_version} and ${current_version}\n\n" >> "${output_path}"
21+
22+
git log ${previous_version}...${current_version} \
23+
--pretty=format:" * [%h](http://github.com/lifting-bits/${PROJECT_NAME}/commit/%H) - %s" \
24+
--reverse | grep -v 'Merge branch' >> "${output_path}"
25+
26+
return 0
27+
}
28+
29+
main $@
30+
exit $?

0 commit comments

Comments
 (0)