From: Timmy Willison Date: Wed, 17 Jul 2024 13:32:02 +0000 (-0400) Subject: Release: ensure builds have the proper version X-Git-Tag: 4.0.0-beta.2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3e612aeeb3821c657989e67b43c9b715f5cd32e2;p=jquery.git Release: ensure builds have the proper version - order hooks in execution order - update workflow actions Closes gh-5519 --- diff --git a/.github/workflows/verify-release.yml b/.github/workflows/verify-release.yml index 89dbc7b65..cd43efac2 100644 --- a/.github/workflows/verify-release.yml +++ b/.github/workflows/verify-release.yml @@ -21,10 +21,10 @@ jobs: NODE_VERSION: 20.x steps: - name: Checkout - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: ${{ env.NODE_VERSION }} diff --git a/.release-it.cjs b/.release-it.cjs index 2061e0160..1de0de548 100644 --- a/.release-it.cjs +++ b/.release-it.cjs @@ -10,11 +10,11 @@ module.exports = { preReleaseBase: 1, hooks: { "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": - `bash ./build/release/post-release.sh \${version} ${ blogURL }` + "after:bump": "cross-env VERSION=${version} npm run build:all", + "before:git:release": "git add -f dist/ dist-module/ changelog.md", + "after:release": `bash ./build/release/post-release.sh \${version} ${ blogURL }` }, git: { changelog: "npm run release:changelog -- ${from} ${to}", diff --git a/build/release/verify.js b/build/release/verify.js index 43d77f800..f167666b2 100644 --- a/build/release/verify.js +++ b/build/release/verify.js @@ -24,13 +24,14 @@ const REGISTRY_URL = "https://registry.npmjs.org/jquery"; const rstable = /^(\d+\.\d+\.\d+)$/; -export async function verifyRelease( { version } = {} ) { +async function verifyRelease( { version } = {} ) { if ( !version ) { version = process.env.VERSION || ( await getLatestVersion() ); } - console.log( `Checking jQuery ${ version }...` ); const release = await buildRelease( { version } ); + console.log( `Verifying jQuery ${ version }...` ); + let verified = true; // Only check stable versions against the CDN @@ -139,8 +140,8 @@ async function buildRelease( { version } ) { .filter( ( dirent ) => dirent.isFile() ) .map( async( dirent ) => ( { name: dirent.name, - path: path.basename( dirent.path ), - contents: await readFile( path.join( dirent.path, dirent.name ), "utf8" ) + path: path.basename( dirent.parentPath ), + contents: await readFile( path.join( dirent.parentPath, dirent.name ), "utf8" ) } ) ) ); @@ -196,3 +197,5 @@ async function sumTarball( filepath ) { const unzipped = await gunzip( contents ); return shasum( unzipped ); } + +verifyRelease(); diff --git a/package-lock.json b/package-lock.json index c21877130..813c769f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ "commitplease": "3.2.0", "concurrently": "8.2.2", "core-js-bundle": "3.37.1", + "cross-env": "7.0.3", "diff": "5.2.0", "eslint": "8.57.0", "eslint-config-jquery": "3.0.2", @@ -3505,6 +3506,24 @@ "node": ">= 14" } }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", diff --git a/package.json b/package.json index 000f947f7..30cb40ae7 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "release:changelog": "node build/release/changelog.js", "release:clean": "rimraf tmp --glob changelog.{md,html} contributors.html", "release:dist": "node build/release/dist.js", - "release:verify": "node -e \"(async () => { const { verifyRelease } = await import('./build/release/verify.js'); verifyRelease() })()\"", + "release:verify": "node build/release/verify.js", "start": "node -e \"(async () => { const { buildDefaultFiles } = await import('./build/tasks/build.js'); buildDefaultFiles({ watch: true }) })()\"", "test:bundlers": "npm run pretest && npm run build:all && node test/bundler_smoke_tests/run-jsdom-tests.js", "test:browser": "npm run pretest && npm run build:main && npm run test:unit -- -b chrome -b firefox -h", @@ -119,6 +119,7 @@ "commitplease": "3.2.0", "concurrently": "8.2.2", "core-js-bundle": "3.37.1", + "cross-env": "7.0.3", "diff": "5.2.0", "eslint": "8.57.0", "eslint-config-jquery": "3.0.2",