From 5518b2da1816b379b573abc55ba92f02776a3486 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Thu, 11 Jul 2024 12:23:10 -0400 Subject: [PATCH] Release: fix running pre/post release scripts in windows - also fix tagging the release in the dist repo Closes gh-5517 --- .release-it.cjs | 7 ++++--- build/release/post-release.sh | 4 +++- build/release/pre-release.sh | 10 ++++++++-- package.json | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.release-it.cjs b/.release-it.cjs index 5d9d9c22e..add1dc66a 100644 --- a/.release-it.cjs +++ b/.release-it.cjs @@ -8,11 +8,12 @@ if ( !blogURL || !blogURL.startsWith( "https://blog.jquery.com/" ) ) { module.exports = { hooks: { - "before:init": "./build/release/pre-release.sh", + "before:init": "bash ./build/release/pre-release.sh", "before:git:release": "git add -f dist/ dist-module/ changelog.md", "after:version:bump": - "sed -i 's/main/AUTHORS.txt/${version}/AUTHORS.txt/' package.json", - "after:release": `./build/release/post-release.sh \${version} ${ blogURL }` + "sed -i 's/main\\/AUTHORS.txt/${version}\\/AUTHORS.txt/' package.json", + "after:release": + `bash ./build/release/post-release.sh \${version} ${ blogURL }` }, git: { changelog: "npm run release:changelog -- ${from} ${to}", diff --git a/build/release/post-release.sh b/build/release/post-release.sh index f5dd1a165..03bdbde1e 100644 --- a/build/release/post-release.sh +++ b/build/release/post-release.sh @@ -33,7 +33,9 @@ cd - npm run release:dist $1 $2 cd $dist git add -A -npm version $1 +git commit -m "Release: $1" +# -s to sign and annotate tag (recommended for releases) +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" diff --git a/build/release/pre-release.sh b/build/release/pre-release.sh index a7b4f18d7..f469b0da0 100644 --- a/build/release/pre-release.sh +++ b/build/release/pre-release.sh @@ -2,11 +2,17 @@ set -euo pipefail -# Cleans all release and build artifacts +# Install dependencies +npm ci + +# Clean all release and build artifacts npm run build:clean npm run release:clean -npm ci + +# Check authors npm run authors:check + +# Run tests npm test # Clone dist and cdn repos to the tmp/release directory diff --git a/package.json b/package.json index 903682952..dccb7119d 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "babel:tests": "babel test/data/core/jquery-iterability-transpiled-es6.js --out-file test/data/core/jquery-iterability-transpiled.js", "build": "node ./build/command.js", "build:all": "node -e \"(async () => { const { buildDefaultFiles } = await import('./build/tasks/build.js'); buildDefaultFiles() })()\"", - "build:clean": "rimraf dist/*.{js,map} dist-module/*.{js,map}", + "build:clean": "rimraf --glob dist/*.{js,map} --glob dist-module/*.{js,map}", "build:main": "node -e \"(async () => { const { build } = await import('./build/tasks/build.js'); build() })()\"", "lint:dev": "eslint --cache .", "lint:json": "jsonlint --quiet package.json", -- 2.39.5