-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugins/npm-post): add new plugin
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |