From 76f8be1c35bb5600041a74fbf8dba9a77c263a4b Mon Sep 17 00:00:00 2001 From: Alessandro Gario <5714290+alessandrogario@users.noreply.github.com> Date: Tue, 23 Feb 2021 00:49:14 +0100 Subject: [PATCH] CI: Use single packaging job, add changelog support (#491) --- .github/workflows/vcpkg_ci.yml | 49 ++++++++++++---------------------- scripts/generate_changelog.sh | 30 +++++++++++++++++++++ 2 files changed, 47 insertions(+), 32 deletions(-) create mode 100755 scripts/generate_changelog.sh diff --git a/.github/workflows/vcpkg_ci.yml b/.github/workflows/vcpkg_ci.yml index 5b998a68f..628eeedd8 100644 --- a/.github/workflows/vcpkg_ci.yml +++ b/.github/workflows/vcpkg_ci.yml @@ -132,13 +132,25 @@ jobs: - 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 remill repository + uses: actions/checkout@v2 + with: + path: remill + fetch-depth: 0 + + - name: Generate the changelog + shell: bash + working-directory: remill + run: | + ./scripts/generate_changelog.sh changelog.md + - name: Download all artifacts uses: actions/download-artifact@v2 @@ -152,6 +164,7 @@ jobs: with: tag_name: ${{ github.ref }} release_name: Version ${{ github.ref }} + body_path: remill/changelog.md draft: true prerelease: true @@ -163,6 +176,9 @@ jobs: zip -r9 remill_ubuntu-20.04_packages.zip \ ubuntu-20.04* + zip -r9 remill_macos-10.15_packages.zip \ + macos-10.15* + - name: Upload the Ubuntu 18.04 packages uses: actions/upload-release-asset@v1 @@ -187,37 +203,6 @@ jobs: asset_name: remill_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 remill_macos-10.15_packages.zip \ - macos-10.15* - - name: Upload the macOS 10.15 packages uses: actions/upload-release-asset@v1 diff --git a/scripts/generate_changelog.sh b/scripts/generate_changelog.sh new file mode 100755 index 000000000..f0af523aa --- /dev/null +++ b/scripts/generate_changelog.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +PROJECT_NAME="remill" + +main() { + if [[ $# != 1 ]] ; then + printf "Usage:\n\tgenerate_changelog.sh \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 $?