-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #758 from geonetwork/auto-publish-npm-package
Automatically publish NPM package on every commit on main branch
- Loading branch information
Showing
6 changed files
with
101 additions
and
1 deletion.
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
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
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
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
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
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,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Will print a version tag taking into account the current project version and whether it's a dev version | ||
# on main branch: 1.0.0-dev.1234abcd (commit tag) | ||
# on feature branch: 1.0.0-dev.branch-name | ||
# on git tag: 1.0.0 (git tag) | ||
|
||
npmVersion=$(node --print 'require("../package.json").version') | ||
gitTag=$(git describe --exact-match --tags 2>/dev/null | sed "s/^v//") # remove "v" in front of version if any | ||
gitBranch=$(git symbolic-ref --short HEAD) | ||
gitRef=$(git rev-parse --short HEAD) | ||
|
||
# git tag defined | ||
if [ -n "${gitTag}" ]; then | ||
echo ${gitTag} | ||
exit 0 | ||
fi | ||
|
||
# main branch | ||
if [ "${gitBranch}" == "main" ]; then | ||
echo "${npmVersion}.${gitRef}" | ||
exit 0 | ||
fi | ||
|
||
echo "${npmVersion}.${gitBranch}" |