Release: ensure builds have the proper version

- order hooks in execution order
- update workflow actions

Closes gh-5519
This commit is contained in:
Timmy Willison 2024-07-17 09:32:02 -04:00 committed by GitHub
parent 1fa8df5dbd
commit 3e612aeeb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 33 additions and 10 deletions

View File

@ -21,10 +21,10 @@ jobs:
NODE_VERSION: 20.x NODE_VERSION: 20.x
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Use Node.js ${{ env.NODE_VERSION }} - name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with: with:
node-version: ${{ env.NODE_VERSION }} node-version: ${{ env.NODE_VERSION }}

View File

@ -10,11 +10,11 @@ module.exports = {
preReleaseBase: 1, preReleaseBase: 1,
hooks: { hooks: {
"before:init": "bash ./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": "after:version:bump":
"sed -i 's/main\\/AUTHORS.txt/${version}\\/AUTHORS.txt/' package.json", "sed -i 's/main\\/AUTHORS.txt/${version}\\/AUTHORS.txt/' package.json",
"after:release": "after:bump": "cross-env VERSION=${version} npm run build:all",
`bash ./build/release/post-release.sh \${version} ${ blogURL }` "before:git:release": "git add -f dist/ dist-module/ changelog.md",
"after:release": `bash ./build/release/post-release.sh \${version} ${ blogURL }`
}, },
git: { git: {
changelog: "npm run release:changelog -- ${from} ${to}", changelog: "npm run release:changelog -- ${from} ${to}",

View File

@ -24,13 +24,14 @@ const REGISTRY_URL = "https://registry.npmjs.org/jquery";
const rstable = /^(\d+\.\d+\.\d+)$/; const rstable = /^(\d+\.\d+\.\d+)$/;
export async function verifyRelease( { version } = {} ) { async function verifyRelease( { version } = {} ) {
if ( !version ) { if ( !version ) {
version = process.env.VERSION || ( await getLatestVersion() ); version = process.env.VERSION || ( await getLatestVersion() );
} }
console.log( `Checking jQuery ${ version }...` );
const release = await buildRelease( { version } ); const release = await buildRelease( { version } );
console.log( `Verifying jQuery ${ version }...` );
let verified = true; let verified = true;
// Only check stable versions against the CDN // Only check stable versions against the CDN
@ -139,8 +140,8 @@ async function buildRelease( { version } ) {
.filter( ( dirent ) => dirent.isFile() ) .filter( ( dirent ) => dirent.isFile() )
.map( async( dirent ) => ( { .map( async( dirent ) => ( {
name: dirent.name, name: dirent.name,
path: path.basename( dirent.path ), path: path.basename( dirent.parentPath ),
contents: await readFile( path.join( dirent.path, dirent.name ), "utf8" ) contents: await readFile( path.join( dirent.parentPath, dirent.name ), "utf8" )
} ) ) } ) )
); );
@ -196,3 +197,5 @@ async function sumTarball( filepath ) {
const unzipped = await gunzip( contents ); const unzipped = await gunzip( contents );
return shasum( unzipped ); return shasum( unzipped );
} }
verifyRelease();

19
package-lock.json generated
View File

@ -26,6 +26,7 @@
"commitplease": "3.2.0", "commitplease": "3.2.0",
"concurrently": "8.2.2", "concurrently": "8.2.2",
"core-js-bundle": "3.37.1", "core-js-bundle": "3.37.1",
"cross-env": "7.0.3",
"diff": "5.2.0", "diff": "5.2.0",
"eslint": "8.57.0", "eslint": "8.57.0",
"eslint-config-jquery": "3.0.2", "eslint-config-jquery": "3.0.2",
@ -3505,6 +3506,24 @@
"node": ">= 14" "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": { "node_modules/cross-spawn": {
"version": "7.0.3", "version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",

View File

@ -64,7 +64,7 @@
"release:changelog": "node build/release/changelog.js", "release:changelog": "node build/release/changelog.js",
"release:clean": "rimraf tmp --glob changelog.{md,html} contributors.html", "release:clean": "rimraf tmp --glob changelog.{md,html} contributors.html",
"release:dist": "node build/release/dist.js", "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 }) })()\"", "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: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", "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", "commitplease": "3.2.0",
"concurrently": "8.2.2", "concurrently": "8.2.2",
"core-js-bundle": "3.37.1", "core-js-bundle": "3.37.1",
"cross-env": "7.0.3",
"diff": "5.2.0", "diff": "5.2.0",
"eslint": "8.57.0", "eslint": "8.57.0",
"eslint-config-jquery": "3.0.2", "eslint-config-jquery": "3.0.2",