From 3e23fda23958864925d074964a576e23debaa659 Mon Sep 17 00:00:00 2001 From: extg5 <135627527+extg5@users.noreply.github.com> Date: Thu, 6 Jun 2024 18:25:36 +0100 Subject: [PATCH] chore: Add creating GH release --- .github/workflows/publish.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9c2b15b..4ca2fe7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,16 +26,17 @@ jobs: run: | # Get the current version from package.json current_version=$(jq -r '.version' package.json) + echo "Current version: $current_version" # Get the previous version from the last commit git fetch --depth=2 previous_version=$(git show HEAD^1:package.json | jq -r '.version') - echo "Current version: $current_version" echo "Previous version: $previous_version" if [ "$current_version" != "$previous_version" ]; then echo "::set-output name=version_changed::true" + echo "::set-output name=current_version::$current_version" else echo "::set-output name=version_changed::false" fi @@ -45,3 +46,13 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_CI_TOKEN }} run: npm publish + + - name: Create GitHub Release + if: steps.version_check.outputs.version_changed == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + current_version=${{ steps.version_check.outputs.current_version }} + gh release create "v$current_version" \ + --title "Release v$current_version" \ + --generate-notes