forked from alertlogic/paws-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ps_spec.yml
53 lines (47 loc) · 1.69 KB
/
ps_spec.yml
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
52
53
version: 1.0
service_name: paws-collector
stages:
-
name: PR Test
when:
- pull_request
- pull_request:
trigger_phrase: test it
image: node:18
compute_size: small
commands:
- make test
-
name: Master Push - Publish
when:
- push: ['master']
image: node:18
compute_size: small
commands:
- |
set -ex
echo //registry.npmjs.org/:_authToken=$NPM_TOKEN > .npmrc
npm whoami
PKGNAME=$(node -e 'console.log(require("./package.json").name)')
PKGVERSION=$(node -e 'console.log(require("./package.json").version)')
WORDCOUNT=$(npm view "${PKGNAME}@${PKGVERSION}" | wc -c)
git config --global credential.helper \'store\' || true
echo "https://$ALPS_GH_USER:[email protected]" > ~/.git-credentials
npm install
if [ $(git tag -l "$PKGVERSION") ]; then
echo "Skip tagging $PKGNAME $PKGVERSION version already exist"
else
git tag -a $PKGVERSION -m "$PKGNAME release $PKGVERSION" HEAD
if [ "$WORDCOUNT" -eq 0 ]; then
make test-all
echo "PUBLISHING $PKGNAME $PKGVERSION"
npm run lint
git push origin $PKGVERSION
npm publish --access public
else
echo "NOT PUBLISHING $PKGNAME $PKGVERSION"
fi
fi
- echo done
outputs:
file: ./.ps_outputs/*