Skip to content

Commit

Permalink
feat(plugins/npm-post): add new plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
dalisoft committed Apr 25, 2024
1 parent 66b6fcb commit 4bd6c96
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions plugins/npm-post.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -eu

prepare() {
if [ "$(command -v GIT_PREPARE)" ]; then
GIT_PREPARE
fi
}

cleanup() {
if [ "$(command -v GIT_CLEANUP)" ]; then
GIT_CLEANUP
fi
}

release() {
# Commiting a `npm` tag
log "Commiting npm tag..."
log_verbose "Git hash: $CHECKOUT_SHA!"

if ! $IS_DRY_RUN; then
prepare

git add package.json

if $IS_WORKSPACE; then
git commit -m "Bump project ${PKG_NAME} version to ${NEXT_RELEASE_VERSION}"
else
git commit -m "Bump package.json version to ${NEXT_RELEASE_VERSION}"
fi

if [[ -n "$GIT_REMOTE_ORIGIN" ]]; then
git push
log_verbose "Pushed update to remote"
else
log_verbose "No Git remote to push tag"
fi

cleanup
else
log "Skipped commiting npm [$NEXT_RELEASE_TAG] tag in DRY-RUN mode."
fi
}

0 comments on commit 4bd6c96

Please sign in to comment.