Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Use single packaging job, add changelog support #99

Merged
merged 1 commit into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 29 additions & 36 deletions .github/workflows/vcpkg_ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
name: VCPKG Continuous Integration

on:
# Run this workflow once every 6 hours against the master branch
schedule:
- cron: "0 */6 * * *"

push:
branches:
- master
- 'master'

tags:
- '*'

pull_request:
schedule:
# run CI every day even if no PRs/merges occur
- cron: '0 6 * * *'
branches:
- '*'

jobs:
build_linux:
Expand Down Expand Up @@ -129,13 +137,25 @@ jobs:
path: ${{ steps.package_names.outputs.TGZ_PACKAGE_PATH }}


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

steps:
- name: Clone the rellic repository
uses: actions/checkout@v2
with:
path: rellic
fetch-depth: 0

- name: Generate the changelog
shell: bash
working-directory: rellic
run: |
./scripts/generate_changelog.sh changelog.md

- name: Download all artifacts
uses: actions/download-artifact@v2

Expand All @@ -149,6 +169,7 @@ jobs:
with:
tag_name: ${{ github.ref }}
release_name: Version ${{ github.ref }}
body_path: rellic/changelog.md
draft: true
prerelease: true

Expand All @@ -160,6 +181,9 @@ jobs:
zip -r9 rellic_ubuntu-20.04_packages.zip \
ubuntu-20.04*

zip -r9 rellic_macos-10.15_packages.zip \
macos-10.15*

- name: Upload the Ubuntu 18.04 packages
uses: actions/upload-release-asset@v1

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




release_macos:
# Do not run the release procedure if any of the builds has failed
needs: [ build_linux, build_mac ]
runs-on: 'macos-10.15'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')

steps:
- name: Download all artifacts
uses: actions/download-artifact@v2

- name: Draft the new release
id: create_release
uses: actions/create-release@v1

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

with:
tag_name: ${{ github.ref }}
release_name: Version ${{ github.ref }}
draft: true
prerelease: true

- name: Group the packages by platform
run: |
zip -r9 rellic_macos-10.15_packages.zip \
macos-10.15*

- name: Upload the macOS 10.15 packages
uses: actions/upload-release-asset@v1

Expand Down
30 changes: 30 additions & 0 deletions scripts/generate_changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

PROJECT_NAME="rellic"

main() {
if [[ $# != 1 ]] ; then
printf "Usage:\n\tgenerate_changelog.sh <path/to/changelog/file.md>\n"
return 1
fi

local output_path="${1}"
local current_version="$(git describe --tags --always)"
local previous_version="$(git describe --tags --always --abbrev=0 ${current_version}^)"

echo "Current version: ${current_version}"
echo "Previous version: ${previous_version}"
echo "Output file: ${output_path}"

printf "# Changelog\n\n" > "${output_path}"
printf "The following are the changes that happened between versions ${previous_version} and ${current_version}\n\n" >> "${output_path}"

git log ${previous_version}...${current_version} \
--pretty=format:" * [%h](http://github.com/lifting-bits/${PROJECT_NAME}/commit/%H) - %s" \
--reverse | grep -v 'Merge branch' >> "${output_path}"

return 0
}

main $@
exit $?