Skip to content

Commit 34811b9

Browse files
CI: Use single packaging job, add changelog support
1 parent 7f324fa commit 34811b9

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
@@ -129,13 +129,25 @@ jobs:
129129
path: ${{ steps.package_names.outputs.TGZ_PACKAGE_PATH }}
130130

131131

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

138138
steps:
139+
- name: Clone the rellic repository
140+
uses: actions/checkout@v2
141+
with:
142+
path: rellic
143+
fetch-depth: 0
144+
145+
- name: Generate the changelog
146+
shell: bash
147+
working-directory: rellic
148+
run: |
149+
./scripts/generate_changelog.sh changelog.md
150+
139151
- name: Download all artifacts
140152
uses: actions/download-artifact@v2
141153

@@ -149,6 +161,7 @@ jobs:
149161
with:
150162
tag_name: ${{ github.ref }}
151163
release_name: Version ${{ github.ref }}
164+
body_path: rellic/changelog.md
152165
draft: true
153166
prerelease: true
154167

@@ -160,6 +173,9 @@ jobs:
160173
zip -r9 rellic_ubuntu-20.04_packages.zip \
161174
ubuntu-20.04*
162175
176+
zip -r9 rellic_macos-10.15_packages.zip \
177+
macos-10.15*
178+
163179
- name: Upload the Ubuntu 18.04 packages
164180
uses: actions/upload-release-asset@v1
165181

@@ -184,37 +200,6 @@ jobs:
184200
asset_name: rellic_ubuntu-20.04_packages.zip
185201
asset_content_type: application/gzip
186202

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

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="rellic"
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)