Skip to content

Commit a5b0c43

Browse files
authored
Release: Fix release issues uncovered during the 4.0.0-rc.1 release
Changes: * Run `pre-release.sh` & `post-release.sh` scripts directly; make them executable * Fix the hashbang to specify the default bash installation; note: `/bin/bash` would be a wrong choice as that would use an ancient 3.x version on macOS * Make sure Bash 5 or newer is used * Run `npm publish --tag beta` when a pre-release is being published * Fix the `repository.url` field in `package.json` as reported by `npm publish` * Fix a few issues reported by shellcheck Closes gh-5697
1 parent 5964acf commit a5b0c43

4 files changed

Lines changed: 30 additions & 10 deletions

File tree

.release-it.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if ( !blogURL || !blogURL.startsWith( "https://blog.jquery.com/" ) ) {
99
module.exports = {
1010
preReleaseBase: 1,
1111
hooks: {
12-
"before:init": "bash ./build/release/pre-release.sh",
12+
"before:init": "./build/release/pre-release.sh",
1313
"after:version:bump":
1414
"sed -i '' -e 's|main/AUTHORS.txt|${version}/AUTHORS.txt|' package.json",
1515
"after:bump": "cross-env VERSION=${version} npm run build:all",

build/release/post-release.sh

100644100755
Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,35 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22

33
set -euo pipefail
44

55
# $1: Version
66
# $2: Blog URL
77

8+
if (( $(echo "$BASH_VERSION" | cut -f1 -d.) < 5 )); then
9+
echo "Bash 5 or newer required. If you're on macOS, the built-in Bash is too old; install a newer one from Homebrew."
10+
exit 1
11+
fi
12+
813
cdn=tmp/release/cdn
914
dist=tmp/release/dist
1015

11-
if [[ -z "$1" ]] then
16+
if [[ -z "$1" ]]; then
1217
echo "Version is not set (1st argument)"
1318
exit 1
1419
fi
1520

16-
if [[ -z "$2" ]] then
21+
if [[ -z "$2" ]]; then
1722
echo "Blog URL is not set (2nd argument)"
1823
exit 1
1924
fi
2025

26+
is_prerelease() {
27+
local v=${1%%+*} # drop build metadata like +exp.sha
28+
[[ $v == *-* ]] # true (0) if prerelease, false (1) otherwise
29+
}
30+
2131
# Push files to cdn repo
22-
npm run release:cdn $1
32+
npm run release:cdn "$1"
2333
cd $cdn
2434
git add -A
2535
git commit -m "jquery: Add version $1"
@@ -30,17 +40,22 @@ git push
3040
cd -
3141

3242
# Push files to dist repo
33-
npm run release:dist $1 $2
43+
# shellcheck disable=SC2086
44+
npm run release:dist "$1" "$2"
3445
cd $dist
3546
git add -A
3647
git commit -m "Release: $1"
3748
# -s to sign and annotate tag (recommended for releases)
38-
git tag -s $1 -m "Release: $1"
49+
git tag -s "$1" -m "Release: $1"
3950

4051
# Wait for confirmation from user to push changes to dist repo
4152
read -p "Press enter to push changes to dist repo & publish to npm"
4253
git push --follow-tags
43-
npm publish
54+
if is_prerelease "$1"; then
55+
npm publish --tag beta
56+
else
57+
npm publish
58+
fi
4459
cd -
4560

4661
# Restore AUTHORS URL

build/release/pre-release.sh

100644100755
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22

33
set -euo pipefail
44

5+
if (( $(echo "$BASH_VERSION" | cut -f1 -d.) < 5 )); then
6+
echo "Bash 5 or newer required. If you're on macOS, the built-in Bash is too old; install a newer one from Homebrew."
7+
exit 1
8+
fi
9+
510
# Install dependencies
611
npm ci
712

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
},
9292
"repository": {
9393
"type": "git",
94-
"url": "https://github.com/jquery/jquery.git"
94+
"url": "git+https://github.com/jquery/jquery.git"
9595
},
9696
"keywords": [
9797
"jquery",

0 commit comments

Comments
 (0)