Skip to content

Commit

Permalink
punlish script changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chathurapathiranage committed Jul 22, 2024
1 parent 1ff5d76 commit 0238532
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions payment_sdk/scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ ARGS:
EOF
}

get_latest_changelog() {
local version=$(node -p "require('./package.json').version")
sed -n "/## $version/,/## /p" CHANGELOG.md | sed '$d' | sed '1d'
}

create_github_release() {
local current_version=$(node -p "require('./package.json').version")
local changelog=$(get_latest_changelog)
local release_notes="v$current_version
Please see the [CHANGELOG.md](https://github.com/degica/mobile-sdk_react-native/blob/main/CHANGELOG.md) for details on this release."
$changelog
For full details, see the [CHANGELOG.md](https://github.com/degica/mobile-sdk_react-native/blob/main/payment_sdk/CHANGELOG.md)."

if which hub | grep -q "not found"; then
if ! command -v hub &> /dev/null; then
echo "hub command not found. Falling back to manual release creation."
create_github_release_fallback "$release_notes"
else
echo "Creating GitHub release for tag: v$current_version"
Expand All @@ -32,10 +41,8 @@ Please see the [CHANGELOG.md](https://github.com/degica/mobile-sdk_react-native/

create_github_release_fallback() {
local release_notes=$1
cat << EOF
Remember to create a release on GitHub at https://github.com/degica/mobile-sdk_react-native/releases/new with the following notes:
$release_notes
EOF
echo "Please create a release manually on GitHub at https://github.com/degica/mobile-sdk_react-native/releases/new with the following notes:"
echo "$release_notes"
}

# Show help if no arguments passed
Expand Down Expand Up @@ -101,7 +108,7 @@ echo "Bumping package.json $RELEASE_TYPE version and tagging commit"
npm version $RELEASE_TYPE

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

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

0 comments on commit 0238532

Please sign in to comment.