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
This commit is contained in:
Michał Gołębiowski-Owczarek
2025-09-16 00:42:53 +02:00
committed by GitHub
parent 5964acf330
commit a5b0c4318d
4 changed files with 30 additions and 10 deletions

View File

@@ -9,7 +9,7 @@ if ( !blogURL || !blogURL.startsWith( "https://blog.jquery.com/" ) ) {
module.exports = {
preReleaseBase: 1,
hooks: {
"before:init": "bash ./build/release/pre-release.sh",
"before:init": "./build/release/pre-release.sh",
"after:version:bump":
"sed -i '' -e 's|main/AUTHORS.txt|${version}/AUTHORS.txt|' package.json",
"after:bump": "cross-env VERSION=${version} npm run build:all",

29
build/release/post-release.sh Normal file → Executable file
View File

@@ -1,25 +1,35 @@
#!/bin/sh
#!/usr/bin/env bash
set -euo pipefail
# $1: Version
# $2: Blog URL
if (( $(echo "$BASH_VERSION" | cut -f1 -d.) < 5 )); then
echo "Bash 5 or newer required. If you're on macOS, the built-in Bash is too old; install a newer one from Homebrew."
exit 1
fi
cdn=tmp/release/cdn
dist=tmp/release/dist
if [[ -z "$1" ]] then
if [[ -z "$1" ]]; then
echo "Version is not set (1st argument)"
exit 1
fi
if [[ -z "$2" ]] then
if [[ -z "$2" ]]; then
echo "Blog URL is not set (2nd argument)"
exit 1
fi
is_prerelease() {
local v=${1%%+*} # drop build metadata like +exp.sha
[[ $v == *-* ]] # true (0) if prerelease, false (1) otherwise
}
# Push files to cdn repo
npm run release:cdn $1
npm run release:cdn "$1"
cd $cdn
git add -A
git commit -m "jquery: Add version $1"
@@ -30,17 +40,22 @@ git push
cd -
# Push files to dist repo
npm run release:dist $1 $2
# shellcheck disable=SC2086
npm run release:dist "$1" "$2"
cd $dist
git add -A
git commit -m "Release: $1"
# -s to sign and annotate tag (recommended for releases)
git tag -s $1 -m "Release: $1"
git tag -s "$1" -m "Release: $1"
# Wait for confirmation from user to push changes to dist repo
read -p "Press enter to push changes to dist repo & publish to npm"
git push --follow-tags
npm publish
if is_prerelease "$1"; then
npm publish --tag beta
else
npm publish
fi
cd -
# Restore AUTHORS URL

7
build/release/pre-release.sh Normal file → Executable file
View File

@@ -1,7 +1,12 @@
#!/bin/sh
#!/usr/bin/env bash
set -euo pipefail
if (( $(echo "$BASH_VERSION" | cut -f1 -d.) < 5 )); then
echo "Bash 5 or newer required. If you're on macOS, the built-in Bash is too old; install a newer one from Homebrew."
exit 1
fi
# Install dependencies
npm ci

View File

@@ -91,7 +91,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/jquery/jquery.git"
"url": "git+https://github.com/jquery/jquery.git"
},
"keywords": [
"jquery",