From 56dc213b399608cfa59295a8554eefdda755f5a9 Mon Sep 17 00:00:00 2001 From: Amit Dhamu Date: Fri, 13 Jan 2023 12:03:35 +0000 Subject: [PATCH] Generate changelog for releases --- .github/workflows/ci.yml | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa6bcdc..bcc7891 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Set Environment Variables run: | @@ -57,18 +59,6 @@ jobs: - name: Build run: yarn build - - name: Create Release - if: github.ref == 'refs/heads/main' - uses: actions/create-release@latest - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - with: - tag_name: ${{ steps.env_vars.outputs.NEW_VERSION }} - release_name: ${{ steps.env_vars.outputs.NEW_VERSION }} - body: "**Full Changelog**: https://github.com/adhamu/arge/compare/${{ steps.env_vars.outputs.PUBLISHED_VERSION }}...${{ steps.env_vars.outputs.NEW_VERSION }}" - draft: false - prerelease: false - - name: Publish to Registry run: | pkg_version=${{ steps.env_vars.outputs.NEW_VERSION }} @@ -79,4 +69,28 @@ jobs: yarn publish --tag beta --access public else yarn publish --access public + git tag $pkg_version + git push --tags fi + + - name: Create Changeset + run: | + CHANGELOG=$(git --no-pager log ${{ steps.env_vars.outputs.PUBLISHED_VERSION }}..HEAD --format="%C(auto)%h %s") + DELIMITER="$(openssl rand -hex 8)" + + echo "RELEASE_NOTES<<${DELIMITER}" >> $GITHUB_OUTPUT + echo -e "$CHANGELOG" >> $GITHUB_OUTPUT + echo "${DELIMITER}" >> $GITHUB_OUTPUT + id: changeset + + - name: Create Release + if: github.ref == 'refs/heads/main' + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + with: + tag_name: ${{ steps.env_vars.outputs.NEW_VERSION }} + release_name: ${{ steps.env_vars.outputs.NEW_VERSION }} + body: "${{ steps.changeset.outputs.RELEASE_NOTES }}\n\n**Full Changelog**: https://github.com/adhamu/arge/compare/${{ steps.env_vars.outputs.PUBLISHED_VERSION }}...${{ steps.env_vars.outputs.NEW_VERSION }}" + draft: false + prerelease: false