-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease
executable file
·45 lines (35 loc) · 1.01 KB
/
release
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
#
# Release a Node package.
# Usage: ./version x.x.x
# @author: Daniel Souza <[email protected]>
# @license: MIT
# Text Decorators
reset="\e[0m"
strong="\e[1;39m"
red="\e[1;31m"
yellow="\e[1;33m"
green="\e[1;32m"
blue="\e[1;34m"
# Strict Mode
# exit when a command has a non-zero exit status
set -e
# check number of args
if [ "$#" -ne 1 ]; then
printf "${red}ERROR:${reset} %s\n" "Illegal number of parameters"
fi
# Main
printf "\n${blue}NOTICE:${reset} %s\n" "Versioning NPM..."
npm version "$1" --git-tag-version=false
printf "\n${blue}NOTICE:${reset} %s\n" "Building assets..."
npm run build
printf "\n${blue}NOTICE:${reset} %s\n" "Versioning Git..."
git add "dist/" "package.json" "package-lock.json"
git commit -m "Release v${1}"
git tag -s "v${1}" -m "v${1}"
printf "\n${blue}NOTICE:${reset} %s\n" "Pushing to Git repository..."
git push
git push origin "v${1}"
printf "\n${blue}NOTICE:${reset} %s\n" "Publishing to NPM repository..."
npm publish
printf "\n${green}DONE:${reset} %s\n" "Released!"