Skip to content

Commit 2b70a18

Browse files
CI: Use single packaging job, add changelog support (#99)
1 parent 7f324fa commit 2b70a18

File tree

2 files changed

+59
-36
lines changed

2 files changed

+59
-36
lines changed

.github/workflows/vcpkg_ci.yml

+29-36
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
name: VCPKG Continuous Integration
2+
23
on:
4+
# Run this workflow once every 6 hours against the master branch
5+
schedule:
6+
- cron: "0 */6 * * *"
7+
38
push:
49
branches:
5-
- master
10+
- 'master'
11+
12+
tags:
13+
- '*'
14+
615
pull_request:
7-
schedule:
8-
# run CI every day even if no PRs/merges occur
9-
- cron: '0 6 * * *'
16+
branches:
17+
- '*'
1018

1119
jobs:
1220
build_linux:
@@ -129,13 +137,25 @@ jobs:
129137
path: ${{ steps.package_names.outputs.TGZ_PACKAGE_PATH }}
130138

131139

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

138146
steps:
147+
- name: Clone the rellic repository
148+
uses: actions/checkout@v2
149+
with:
150+
path: rellic
151+
fetch-depth: 0
152+
153+
- name: Generate the changelog
154+
shell: bash
155+
working-directory: rellic
156+
run: |
157+
./scripts/generate_changelog.sh changelog.md
158+
139159
- name: Download all artifacts
140160
uses: actions/download-artifact@v2
141161

@@ -149,6 +169,7 @@ jobs:
149169
with:
150170
tag_name: ${{ github.ref }}
151171
release_name: Version ${{ github.ref }}
172+
body_path: rellic/changelog.md
152173
draft: true
153174
prerelease: true
154175

@@ -160,6 +181,9 @@ jobs:
160181
zip -r9 rellic_ubuntu-20.04_packages.zip \
161182
ubuntu-20.04*
162183
184+
zip -r9 rellic_macos-10.15_packages.zip \
185+
macos-10.15*
186+
163187
- name: Upload the Ubuntu 18.04 packages
164188
uses: actions/upload-release-asset@v1
165189

@@ -184,37 +208,6 @@ jobs:
184208
asset_name: rellic_ubuntu-20.04_packages.zip
185209
asset_content_type: application/gzip
186210

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-
218211
- name: Upload the macOS 10.15 packages
219212
uses: actions/upload-release-asset@v1
220213

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)