Skip to content

Commit 2cf6591

Browse files
committed
Release: migrate release process to release-it
*Authors* - Checking and updating authors has been migrated to a custom script in the repo *Changelog* - changelogplease is no longer maintained - generate changelog in markdown for GitHub releases - generate changelog in HTML for blog posts - generate contributors list in HTML for blog posts *dist* - clone dist repo, copy files, and commit/push - commit tag with dist files on main branch; remove dist files from main branch after release *cdn* - clone cdn repo, copy files, and commit/push - create versioned and unversioned copies in cdn/ - generate md5 sums and archives for Google and MSFT *build* - implement reproducible builds and verify release builds * uses the last modified date for the latest commit * See https://reproducible-builds.org/ - the verify workflow also ensures all files were properly published to the CDN and npm *docs* - the new release workflow is documented at build/release/README.md *verify* - use the last modified date of the commit before the tag - use versioned filenames when checking map files on the CDN - skip factory and package.json files when verifying CDN *misc* - now that we don't need the jquery-release script and now that we no longer need to build on Node 10, we can use ESM in all files in the build folder - limit certain workflows to the main repo (not forks) - version has been set to the previously released version 3.7.1, as release-it expects - release-it added the `preReleaseBase` option and we now always set it to `1` in the npm script. This is a noop for stable releases. - include post-release script to be run manually after a release, with further steps that should be verified manually Ref jquery/jquery-release#114 Closes jquerygh-5522
1 parent 3b23302 commit 2cf6591

35 files changed

+4880
-815
lines changed

.editorconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ insert_final_newline = true
1313
[*.{json,yml}]
1414
indent_style = space
1515
indent_size = 2
16-

.github/workflows/filestash.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ permissions:
1010

1111
jobs:
1212
update:
13+
name: Update Filestash
1314
runs-on: ubuntu-latest
15+
# skip on forks
16+
if: ${{ github.repository == 'jquery/jquery' }}
1417
environment: filestash
1518
env:
1619
NODE_VERSION: 20.x
17-
name: Update Filestash
1820
steps:
1921
- name: Checkout
2022
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

.github/workflows/verify-release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Reproducible Builds
2+
on:
3+
push:
4+
# On tags
5+
tags:
6+
- '*'
7+
# Or manually
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: 'Version to verify (>= 4.0.0-rc.1)'
12+
required: false
13+
14+
15+
jobs:
16+
run:
17+
name: Verify release
18+
runs-on: ubuntu-latest
19+
# skip on forks
20+
if: ${{ github.repository == 'jquery/jquery' }}
21+
env:
22+
NODE_VERSION: 20.x
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
26+
27+
- name: Use Node.js ${{ env.NODE_VERSION }}
28+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
29+
with:
30+
node-version: ${{ env.NODE_VERSION }}
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- run: npm run release:verify
36+
env:
37+
VERSION: ${{ github.event.inputs.version || github.ref_name }}

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
*~
44
*.diff
55
*.patch
6-
/*.html
76
.DS_Store
87
.bower.json
98
.sizecache.json
109
yarn.lock
1110
.eslintcache
11+
tmp
1212

1313
npm-debug.log*
1414

@@ -23,6 +23,10 @@ npm-debug.log*
2323
/test/data/core/jquery-iterability-transpiled.js
2424
/test/data/qunit-fixture.js
2525

26-
# Ignore BrowserStack files
26+
# Release artifacts
27+
changelog.html
28+
contributors.html
29+
30+
# Ignore BrowserStack testing files
2731
local.log
2832
browserstack.err

.npmignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
.eslintignore
2+
.eslintcache
23
eslint.config.js
34

45
/.editorconfig
56
/.gitattributes
67
/.mailmap
8+
/.sizecache.json
79

810
/build
911
/external
10-
/speed
1112
/test
12-
/Gruntfile.js
13+
/tmp
14+
/changelog.html
15+
/contributors.html

.release-it.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"use strict";
2+
3+
const blogURL = process.env.BLOG_URL;
4+
5+
if ( !blogURL || !blogURL.startsWith( "https://blog.jquery.com/" ) ) {
6+
throw new Error( "A valid BLOG_URL must be set in the environment" );
7+
}
8+
9+
// This is needed because until the release-it migration,
10+
// all the previous release tags were disconnected from the 3.x branch.
11+
// We can remove this if/when we do a 3.x release with the new setup.
12+
const from = process.env.FROM_VERSION;
13+
14+
module.exports = {
15+
preReleaseBase: 1,
16+
hooks: {
17+
"before:init": "bash ./build/release/pre-release.sh",
18+
"after:version:bump":
19+
"sed -i 's/main\\/AUTHORS.txt/${version}\\/AUTHORS.txt/' package.json",
20+
"after:bump": "cross-env VERSION=${version} npm run build:all",
21+
"before:git:release": "git add -f dist/ dist-module/ changelog.md",
22+
"after:release": "echo 'Run the following to complete the release:' && " +
23+
`echo './build/release/post-release.sh $\{version} ${ blogURL }'`
24+
},
25+
git: {
26+
27+
// Use the node script directly to avoid an npm script
28+
// command log entry in the GH release notes
29+
changelog: `node build/release/changelog.js ${ from ? from : "${from}" } $\{to}`,
30+
commitMessage: "Release: ${version}",
31+
getLatestTagFromAllRefs: true,
32+
pushRepo: "[email protected]:jquery/jquery.git",
33+
requireBranch: "main",
34+
requireCleanWorkingDir: true
35+
},
36+
github: {
37+
pushRepo: "[email protected]:jquery/jquery.git",
38+
release: true,
39+
tokenRef: "JQUERY_GITHUB_TOKEN"
40+
},
41+
npm: {
42+
publish: true
43+
}
44+
};

build/command.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
"use strict";
2-
3-
const { build } = require( "./tasks/build" );
4-
const yargs = require( "yargs/yargs" );
5-
const slimExclude = require( "./tasks/lib/slim-exclude" );
1+
import yargs from "yargs/yargs";
2+
import { build } from "./tasks/build.js";
3+
import slimExclude from "./tasks/lib/slim-exclude.js";
64

75
const argv = yargs( process.argv.slice( 2 ) )
86
.version( false )

build/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "module"
3+
}

build/release.js

Lines changed: 0 additions & 82 deletions
This file was deleted.

build/release/README.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Releasing jQuery
2+
3+
This document describes the process for releasing a new version of jQuery. It is intended for jQuery team members and collaborators who have been granted permission to release new versions.
4+
5+
## Prerequisites
6+
7+
Before you can release a new version of jQuery, you need to have the following tools installed:
8+
9+
- [Node.js](https://nodejs.org/) (latest LTS version)
10+
- [npm](https://www.npmjs.com/) (comes with Node.js)
11+
- [git](https://git-scm.com/)
12+
13+
## Setup
14+
15+
1. Clone the jQuery repo:
16+
17+
```sh
18+
git clone [email protected]:jquery/jquery.git
19+
cd jquery
20+
```
21+
22+
1. Install the dependencies:
23+
24+
```sh
25+
npm install
26+
```
27+
28+
1. Log into npm with a user that has access to the `jquery` package.
29+
30+
```sh
31+
npm login
32+
```
33+
34+
The release script will not run if not logged in.
35+
36+
1. Set `JQUERY_GITHUB_TOKEN` in the shell environment that will be used to run `npm run release`. The token can be [created on GitHub](https://github.com/settings/tokens/new?scopes=repo&description=release-it) and only needs the `repo` scope. This token is used to publish GitHub release notes and generate a list of contributors for the blog post.
37+
38+
```sh
39+
export JQUERY_GITHUB_TOKEN=...
40+
```
41+
42+
The release script will not run without this token.
43+
44+
## Release Process
45+
46+
1. Ensure all milestoned issues/PRs are closed, or reassign to a new milestone.
47+
1. Verify all tests are passing in [CI](https://github.com/jquery/jquery/actions).
48+
1. Run any release-only tests, such as those in the [`test/integration`](../../test/integration/) folder.
49+
1. Ensure AUTHORS.txt file is up to date (this will be verified by the release script).
50+
51+
- Use `npm run authors:update` to update.
52+
53+
1. Create draft blog post on blog.jquery.com; save the link before publishing. The link is required to run the release.
54+
55+
- Highlight major changes and reason for release.
56+
- Add HTML from the `changelog.html` generated in the below release script.
57+
- Use HTML from the `contributors.html` generated in the below release script in the "Thanks" section.
58+
59+
1. Run a dry run of the release script:
60+
61+
```sh
62+
BLOG_URL=https://blog.jquery.com/... npm run release -- -d
63+
```
64+
65+
1. If the dry run is successful, run the release script:
66+
67+
```sh
68+
BLOG_URL=https://blog.jquery.com/... npm run release
69+
```
70+
71+
This will run the pre-release script, which includes checking authors, running tests, running the build, and cloning the CDN and jquery-dist repos in the `tmp/` folder.
72+
73+
It will then walk you through the rest of the release process: creating the tag, publishing to npm, publishing release notes on GitHub, and pushing the updated branch and new tag to the jQuery repo.
74+
75+
Finally, it will run the post-release script, which will ask you to confirm the files prepared in `tmp/release/cdn` and `tmp/release/dist` are correct before pushing to the respective repos. It will also prepare a commit for the jQuery repo to remove the release files and update the AUTHORS.txt URL in the package.json. It will ask for confirmation before pushing that commit as well.
76+
77+
For a pre-release, run:
78+
79+
```sh
80+
BLOG_URL=https://blog.jquery.com/... npm run release -- --preRelease=beta
81+
```
82+
83+
`preRelease` can also be set to `alpha` or `rc`.
84+
85+
**Note**: `preReleaseBase` is set in the npm script to `1` to ensure any pre-releases start at `.1` instead of `.0`. This does not interfere with stable releases.
86+
87+
1. Run the post-release script:
88+
89+
```sh
90+
./build/release/post-release.sh $VERSION $BLOG_URL
91+
```
92+
93+
This will push the release files to the CDN and jquery-dist repos, and push the commit to the jQuery repo to remove the release files and update the AUTHORS.txt URL in the package.json.
94+
95+
1. Once the release is complete, publish the blog post.
96+
97+
## Stable releases
98+
99+
Stable releases have a few more steps:
100+
101+
1. Close the milestone matching the current release: https://github.com/jquery/jquery/milestones. Ensure there is a new milestone for the next release.
102+
1. Update jQuery on https://github.com/jquery/jquery-wp-content.
103+
1. Update jQuery on https://github.com/jquery/blog.jquery.com-theme.
104+
1. Update latest jQuery version for [healthyweb.org](https://github.com/jquery/healthyweb.org/blob/main/wrangler.toml).
105+
1. Update the shipping version on [jquery.com home page](https://github.com/jquery/jquery.com).
106+
107+
```sh
108+
git pull jquery/jquery.com
109+
# Edit index.html and download.md
110+
git commit
111+
npm version patch
112+
git push origin main --tags
113+
```
114+
115+
1. Update the version used in [jQuery docs demos](https://github.com/jquery/api.jquery.com/blob/main/entries2html.xsl).
116+
117+
1. Email archives to CDNs.
118+
119+
| CDN | Emails | Include |
120+
| --- | ------ | ------- |
121+
| Google | hosted-libraries@google | `tmp/archives/googlecdn-jquery-*.zip` |
122+
| Microsoft | damian.edwards@microsoft, Chris.Sfanos@microsoft | `tmp/archives/mscdn-jquery-*.zip` |
123+
| CDNJS | ryan@ryankirkman, thomasalwyndavis@gmail | Blog post link |

0 commit comments

Comments
 (0)