@@ -25,63 +25,52 @@ if ! command -v npm >/dev/null; then
25
25
exit 1
26
26
fi
27
27
28
- if [[ (-n $CI ) && (-n $NPM_AUTH_TOKEN ) ]]; then
29
- echo " //registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN} " > $HOME /.npmrc
30
- fi
31
-
32
28
if ! npm whoami > /dev/null 2>&1 ; then
33
- echo " ERROR: NPM failed to log in"
34
- exit 1
35
- fi
36
-
37
- UPSTREAM_SHA=$( git ls-remote https://github.com/microsoft/playwright --tags master | cut -f1)
38
- CURRENT_SHA=$( git rev-parse HEAD)
39
-
40
- if [[ " ${UPSTREAM_SHA} " != " ${CURRENT_SHA} " ]]; then
41
- echo " REFUSING TO PUBLISH: this is not tip-of-tree"
29
+ echo " ERROR: NPM is not logged in."
42
30
exit 1
43
31
fi
44
32
45
33
cd ..
46
34
35
+ NPM_PUBLISH_TAG=" next"
36
+ VERSION=$( node -e ' console.log(require("./package.json").version)' )
37
+
47
38
if [[ $1 == " --release" ]]; then
48
- if [[ -n $CI ]]; then
49
- echo " Found \$ CI env - cannot publish real release from CI"
50
- exit 1
51
- fi
52
39
if [[ -n $( git status -s) ]]; then
53
40
echo " ERROR: git status is dirty; some uncommitted changes or untracked files"
54
41
exit 1
55
42
fi
56
- VERSION=$( node -e ' console.log(require("./package.json").version)' )
57
- echo -n " Publish Playwright v${VERSION} (y/N)? "
58
- read ANSWER
59
- if [[ " $ANSWER " != " y" ]]; then
60
- echo " Bailing out."
43
+ # Ensure package version does not contain dash.
44
+ if [[ " ${VERSION} " == * -* ]]; then
45
+ echo " ERROR: cannot publish pre-release version with --release flag"
61
46
exit 1
62
47
fi
63
-
64
- npm run clean
65
- npm publish .
66
- npm publish packages/playwright-firefox
67
- npm publish packages/playwright-webkit
68
- npm publish packages/playwright-chromium
69
- npm publish packages/playwright
70
- echo " Done."
48
+ NPM_PUBLISH_TAG=" latest"
71
49
elif [[ $1 == " --tip-of-tree" ]]; then
72
- if [[ -z $CI ]]; then
73
- echo " Did not find \$ CI env - cannot publish tip-of-tree release not from CI"
50
+ # Ensure package version contains dash.
51
+ if [[ " ${VERSION} " != * -* ]]; then
52
+ echo " ERROR: cannot publish release version with --tip-of-tree flag"
74
53
exit 1
75
54
fi
76
- npm run clean
77
- npm publish . --tag=" next"
78
- npm publish packages/playwright-firefox --tag=" next"
79
- npm publish packages/playwright-webkit --tag=" next"
80
- npm publish packages/playwright-chromium --tag=" next"
81
- npm publish packages/playwright --tag=" next"
82
- echo " Done."
55
+
56
+ # Ensure this is actually tip-of-tree.
57
+ UPSTREAM_SHA=$( git ls-remote https://github.com/microsoft/playwright --tags master | cut -f1)
58
+ CURRENT_SHA=$( git rev-parse HEAD)
59
+ if [[ " ${UPSTREAM_SHA} " != " ${CURRENT_SHA} " ]]; then
60
+ echo " REFUSING TO PUBLISH: this is not tip-of-tree"
61
+ exit 1
62
+ fi
63
+ NPM_PUBLISH_TAG=" next"
83
64
else
84
65
echo " unknown argument - '$1 '"
85
66
exit 1
86
67
fi
87
68
69
+ npm run clean
70
+ npm publish . --tag=" ${NPM_PUBLISH_TAG} " --dry-run
71
+ npm publish packages/playwright-firefox --tag=" ${NPM_PUBLISH_TAG} " --dry-run
72
+ npm publish packages/playwright-webkit --tag=" ${NPM_PUBLISH_TAG} " --dry-run
73
+ npm publish packages/playwright-chromium --tag=" ${NPM_PUBLISH_TAG} " --dry-run
74
+ npm publish packages/playwright --tag=" ${NPM_PUBLISH_TAG} " --dry-run
75
+
76
+ echo " Done."
0 commit comments