Skip to content

Commit

Permalink
script updates
Browse files Browse the repository at this point in the history
  • Loading branch information
chathurapathiranage committed Jul 24, 2024
1 parent 29c9422 commit 3bc6d86
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions payment_sdk/scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,17 @@ EOF

get_latest_changelog() {
local version=$(node -p "require('./package.json').version")
awk "/## $version/,/^## / { if (!/^## / && !/^$/) print }" CHANGELOG.md | sed 's/^/• /'
awk "/## $version/,/^$/ { if (!/^## / && !/^$/) print }" CHANGELOG.md
}

create_github_release() {
# Fetch the new version after bumping
local current_version=$(node -p "require('./package.json').version")

# Fetch the changelog for the updated version
local changelog=$(get_latest_changelog)

local release_notes="v$current_version
Changes:
$changelog
$(echo "$changelog" | sed 's/^/> /')
For full details, see the [CHANGELOG.md](https://github.com/degica/mobile-sdk_react-native/blob/main/payment_sdk/CHANGELOG.md)."

if ! command -v hub &> /dev/null; then
Expand Down Expand Up @@ -113,16 +107,15 @@ npm run build
echo "Bumping package.json $RELEASE_TYPE version and tagging commit"
npm version $RELEASE_TYPE

# Create GitHub release with updated changelog
create_github_release

echo "Publishing release to npm"
# npm publish --access=public
npm publish --access=public

echo "Pushing git commit and tag"
git push --follow-tags

echo "Publish successful!"
echo ""

echo "Done!"
create_github_release

echo "Done!"

0 comments on commit 3bc6d86

Please sign in to comment.