Skip to content

Commit

Permalink
CI: Use single packaging job, add changelog support (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrogario authored Feb 22, 2021
1 parent 6db8551 commit 76f8be1
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 32 deletions.
49 changes: 17 additions & 32 deletions .github/workflows/vcpkg_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

Expand All @@ -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

Expand All @@ -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

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="remill"

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 $?

0 comments on commit 76f8be1

Please sign in to comment.