From 1937a76e410bdf0c2eb33939cfa635d34a022dd6 Mon Sep 17 00:00:00 2001 From: Niall Byrne <9848926+niall-byrne@users.noreply.github.com> Date: Sat, 18 Jun 2022 14:18:02 -0400 Subject: [PATCH] ci(GITHUB): script changelog generation --- .github/scripts/changelog.sh | 21 +++++++++++++++++++++ .github/workflows/push.yml | 12 ++++-------- 2 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 .github/scripts/changelog.sh diff --git a/.github/scripts/changelog.sh b/.github/scripts/changelog.sh new file mode 100644 index 0000000..0017f5a --- /dev/null +++ b/.github/scripts/changelog.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -eo pipefail + +main() { + + echo "{}" > package.json + TAG="$(git tag | sort --version-sort | tail -n 2 | head -n 1)" + CHANGE_LOG_CONTENT="$(npx -q generate-changelog -f - -t "${TAG}")" + + { + echo "CHANGE_LOG_CONTENT<> "$GITHUB_ENV" + + rm package.json + +} + +main diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 1cc1d6a..7daba7c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -34,18 +34,15 @@ jobs: if: contains(github.ref, '/tags/v') run: | source ./.github/scripts/setup.sh - echo "{}" > package.json env: WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - name: Release -- Generate Changelog if: contains(github.ref, '/tags/v') - uses: scottbrenner/generate-changelog-action@v1.3.3 - id: Changelog - env: - REPO: ${{ github.repository }} + run: + source ./.github/scripts/changelog.sh - - name: Release -- Create Github Release + - name: Release -- Create GitHub Release if: contains(github.ref, '/tags/v') uses: actions/create-release@v1 env: @@ -54,7 +51,7 @@ jobs: tag_name: ${{ env.BRANCH_OR_TAG }} release_name: Release ${{ env.BRANCH_OR_TAG }} body: | - ${{ steps.Changelog.outputs.changelog }} + ${{ env.CHANGE_LOG_CONTENT }} draft: true prerelease: false @@ -187,7 +184,6 @@ jobs: ./.github/scripts/notifications.sh "${NOTIFICATION}" ":x: OSX ${{ matrix.os }}, molecule test scenario '${SCENARIO}' failed!" env: SCENARIO: ${{ matrix.scenario}} - security_test: runs-on: ubuntu-latest