From 2654e89c57057208fe21b2a9a76879b057676c13 Mon Sep 17 00:00:00 2001 From: Amit Dhamu Date: Sat, 14 Jan 2023 11:30:29 +0000 Subject: [PATCH] Update pipeline with automated release notes --- .github/workflows/ci.yml | 28 ++++++++++++++++++++-------- package.json | 2 +- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df7e4b0..4e31541 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,13 +13,15 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Set Environment Variables run: | - echo ::set-output name=NODE_VERSION::$(cat .nvmrc) - echo ::set-output name=CURRENT_VERSION::$(cat package.json | jq -r '.version') - echo ::set-output name=PUBLISHED_VERSION::$(npm view react-input-suggestions version) - echo ::set-output name=BRANCH::${GITHUB_REF##*/} + echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT + echo "NEW_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT + echo "PUBLISHED_VERSION=$(npm view react-input-suggestions version)" >> $GITHUB_OUTPUT + echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT id: env_vars - name: Install Node.js ${{ steps.env_vars.outputs.NODE_VERSION }} @@ -74,15 +76,25 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.PAT }} with: - tag_name: ${{ steps.env_vars.outputs.CURRENT_VERSION }} - release_name: ${{ steps.env_vars.outputs.CURRENT_VERSION }} - body: "**Full Changelog**: https://github.com/adhamu/react-input-suggestions/compare/${{ steps.env_vars.outputs.PUBLISHED_VERSION }}...${{ steps.env_vars.outputs.CURRENT_VERSION }}" + 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/zero/compare/${{ steps.env_vars.outputs.PUBLISHED_VERSION }}...${{ steps.env_vars.outputs.NEW_VERSION }}" draft: false prerelease: false + - 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: Publish to Registry run: | - pkg_version=${{ steps.env_vars.outputs.CURRENT_VERSION }} + pkg_version=${{ steps.env_vars.outputs.NEW_VERSION }} branch=${{ steps.env_vars.outputs.BRANCH }} if [[ $branch != "main" ]]; then diff --git a/package.json b/package.json index a4562b5..0196a54 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-input-suggestions", - "version": "2.3.1", + "version": "2.3.2", "description": "A React input component with pluggable suggestions and autocomplete", "keywords": [ "react",