Skip to content

Commit

Permalink
Update pipeline with automated release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
adhamu committed Jan 14, 2023
1 parent 6b5ee18 commit 2654e89
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 2654e89

Please sign in to comment.