-
Notifications
You must be signed in to change notification settings - Fork 23
/
release-percy.sh
executable file
·30 lines (23 loc) · 1.09 KB
/
release-percy.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
#!/bin/bash
# Set the npm registry auth token
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
# Grab the local version and check to see if that version exists on npm
agentAlreadyReleased=$(npm view @percy/agent versions | grep $(node -p "require('./package.json').version"))
# If the package with that version has not yet been released, go ahead and release it.
if [ !$agentAlreadyReleased ]; then
npm publish
else
echo "Skipping @percy/agent publishing because the desired version has already been published."
fi
# Ship the `percy` shadow package
# https://www.npmjs.com/package/percy
# First we jam `percy` into the package name
sed -i 's/@percy\/agent/percy/g' package.json
# Next we grab the local version and check to see if that version exists on npm
percyAlreadyReleased=$(npm view percy versions | grep $(node -p "require('./package.json').version"))
# If the package with that version has not yet been released, go ahead and release it.
if [ !$percyAlreadyReleased ]; then
npm publish
else
echo "Skipping percy publishing because the desired version has already been published."
fi