Skip to content

Commit

Permalink
Build: Remove pushing of release artefact to Git commit
Browse files Browse the repository at this point in the history
Cherry-picked from e9e3ecf (3.0.0-dev):
> Build: Remove pushing of release artefact to detached Git commit

Cherry-picked from 666890b (3.0.0-dev):
> Build: Combine build+prep
  • Loading branch information
Krinkle committed Aug 18, 2024
1 parent 47e32ea commit c8466c6
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 7,829 deletions.
78 changes: 34 additions & 44 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ This guide walks you through the QUnit release.

QUnit aims for its releases to be reproducible. Recent releases are automatically verified on a regular basis ([reproducible builds status](https://github.com/qunitjs/qunit/actions/workflows/reproducible.yaml)). Read more on [Wikipedia](https://en.wikipedia.org/wiki/Reproducible_builds), and [reproducible-builds.org](https://reproducible-builds.org/).


⚠️ **WARNING** ⚠️

> Before starting, make sure you have:
Expand All @@ -14,12 +13,14 @@ QUnit aims for its releases to be reproducible. Recent releases are automaticall
>
> System prerequisites:
>
> * Node.js 14, or later.
> * Node.js 18, or later.
> * Git 2.11, or later.
Ensure that all changes for this release have been merged into the main branch. For patch releases, try landing any other bug fixes; for minor releases, ensure new features have been documented and tested. Major releases likely have their own checklist.

1. Create a local `release` branch, and ensure it is up-to-date:
## Preparing the release

1. Create a local `release` branch, and ensure it is up-to-date:
Verify that the canonical repository is cloned (not a fork):
```
git remote -v
Expand All @@ -36,7 +37,7 @@ Ensure that all changes for this release have been merged into the main branch.
npm ci
```

3. Create the release preparation commit:
3. Prepare for the release commit:
```
node build/prep-release.js @VERSION
```
Expand All @@ -45,24 +46,6 @@ Ensure that all changes for this release have been merged into the main branch.
* In `AUTHORS.txt`, if you see duplicate entries, then use the `.mailmap` file to normalize them to a canonical name and e-mail address, and then re-run the above command.
* Edit `History.md` to remove changes not relevant to end-users (e.g. changes relating to tests, build, internal refactoring, doc fixes, etc.).

Commit your changes with the following message (replace `@VERSION` with the release version):
```
Build: Prepare @VERSION release
```

Push the `release` branch to GitHub.
Once CI is passing, push again, this time to the (protected) `main` branch.

## Performing the release

Verify that your local repo is at the release preparation commit:

```
git show
# Build: Prepare x.y.z release
# …
```

4. Build the release:
```
node build/build-release.js @VERSION
Expand All @@ -73,13 +56,38 @@ git show
```
node build/review-package.js @LAST_VERSION
# … reviews package.json, qunit.js, and qunit.css
# … review package.json, qunit.js, and qunit.css
```

Commit your changes with the following message (replace `@VERSION` with the release version):
```
Release @VERSION
```

Push a `release` branch to GitHub.
Once CI is passing, push again, this time to the (protected) `stable-2.x` branch.

## Publish the release

Verify that your local repo is on a clean checkout with HEAD at the release commit:

```
git show
# Release x.y.z
# …
```

And that you have release artefacts from the previous step in your working directory (i.e. same version, and not a "dev" version). If you don't have this, go back to step 4 "Build the release".

```
head qunit/qunit.js
# /*!
# * QUnit x.y.z
# …
```

5. Publish to GitHub.<br>⚠️ Do not push to the main branch!
5. Publish tag to GitHub.
```
git add -f package.json qunit/
git commit -m "Release @VERSION"
git tag -s "@VERSION" -m "Release @VERSION"
git push --tags
```
Expand All @@ -100,24 +108,6 @@ git show
```
Verify that the release is listed at <https://code.jquery.com/qunit/> and that you can open the JS/CSS files.

## Updating the website

After the release is published, we need to update the website.

Check out the main branch of the [qunitjs/qunit](https://github.com/qunitjs/qunit) repository, and ensure it is clean and up-to-date. Run the following script, which will update release links and demos to use the new version:

```
qunit$ node build/site-set-version.js VERSION
```

Stage the changes it made, and commit with the following message:

```
Docs: Update url and version to VERSION
```

Push the commit to a branch on origin, wait CI checks to complete, then re-push to the main branch. Check the website in a few minutes to verify the change ([deployment log](https://github.com/qunitjs/qunit/deployments/activity_log?environment=github-pages)).

## Final steps

You're almost there! Make sure you update [GitHub releases](https://github.com/qunitjs/qunit/releases) using the changelog from `History.md`.
Expand Down
13 changes: 4 additions & 9 deletions build/build-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,14 @@ const Repo = {
}
{
const file = 'package.json';
console.log(`Updating ${file}...`);
console.log(`Checking ${file}...`);
const filePath = path.join(__dirname, '..', file);
const json = fs.readFileSync(filePath, 'utf8');
const packageIndentation = json.match(/\n([\t\s]+)/)[1];
const data = JSON.parse(json);

data.version = version;
data.author.url = data.author.url.replace('main', version);

fs.writeFileSync(
filePath,
JSON.stringify(data, null, packageIndentation) + '\n'
);
if (data.version !== version) {
throw new Error('Must run build-release on release commit, found package.version at ' + data.version);
}
}
{
console.log('Running `npm run build`...');
Expand Down
4 changes: 2 additions & 2 deletions build/prep-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const Repo = {
const packageIndentation = json.match(/\n([\t\s]+)/)[1];
const data = JSON.parse(json);

data.version = `${version}-pre`;
data.version = version;

fs.writeFileSync(
filePath,
Expand All @@ -126,7 +126,7 @@ const Repo = {
const packageIndentation = json.match(/\n([\t\s]+)/)[1];
const data = JSON.parse(json);

data.version = data.packages[''].version = `${version}-pre`;
data.version = data.packages[''].version = version;

fs.writeFileSync(
filePath,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"homepage": "https://qunitjs.com",
"author": {
"name": "OpenJS Foundation and other contributors",
"url": "https://github.com/qunitjs/qunit/blob/2.21.1/AUTHORS.txt"
"url": "https://github.com/qunitjs/qunit/blob/main/AUTHORS.txt"
},
"repository": {
"type": "git",
Expand Down
Loading

0 comments on commit c8466c6

Please sign in to comment.