diff --git a/.github/workflows/vcpkg_ci.yml b/.github/workflows/vcpkg_ci.yml index 1d6cfec1..fa0c3035 100644 --- a/.github/workflows/vcpkg_ci.yml +++ b/.github/workflows/vcpkg_ci.yml @@ -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: @@ -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 @@ -149,6 +169,7 @@ jobs: with: tag_name: ${{ github.ref }} release_name: Version ${{ github.ref }} + body_path: rellic/changelog.md draft: true prerelease: true @@ -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 @@ -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 diff --git a/scripts/generate_changelog.sh b/scripts/generate_changelog.sh new file mode 100755 index 00000000..d1ec3816 --- /dev/null +++ b/scripts/generate_changelog.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +PROJECT_NAME="rellic" + +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 $?