-
Notifications
You must be signed in to change notification settings - Fork 13
/
release.sh
executable file
·51 lines (36 loc) · 1.31 KB
/
release.sh
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
46
47
48
49
50
51
#!/bin/bash
set -euo pipefail
# configure Git user and e-mail for the release commit
git config user.name "supercharge-bot"
git config user.email [email protected]
# generate changelog and new version number then create a release commit
npm run release
# start SSH agent
eval $(ssh-agent -t 60 -s)
# add SSH key to push the release commit and tag with
echo "${SUPERCHARGE_BOT_DEPLOY_KEY}" | ssh-add -
# add github.com as known host -> SSH connect won't ask it
mkdir -p ~/.ssh/
ssh-keyscan github.com >> ~/.ssh/known_hosts
# push the release commit and the new tag to the upstream
git push --follow-tags [email protected]:team-supercharge/nest-amqp.git master
# delete all manually added SSH keys
ssh-add -D
# stop SSH agent
ssh-agent -k
# remove the github.com known host
rm ~/.ssh/known_hosts
# build the production app
npm run build:prod
# copy the files to the dist directory
cp package.json README.md LICENSE dist/
# remove unnecessary devDependencies and scripts objects from the production package.json
./node_modules/.bin/json -I -f dist/package.json -e 'this.devDependencies=undefined' -e 'this.scripts=undefined'
# go to the production build directory
cd dist
# add auth token
echo "//registry.npmjs.org/:_authToken=${NPM_LOGIN_TOKEN}" > .npmrc
# publish the package to NPM
npm publish
# cleanup
rm .npmrc