Skip to content

Commit 05ead28

Browse files
authored
Update release process & maintaining notes
* Add Release workflow * Update maintaining.md to reflect the actual process.
1 parent 859f3ff commit 05ead28

File tree

3 files changed

+100
-14
lines changed

3 files changed

+100
-14
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on:
33
push:
44
branches:
55
- main
6+
tags:
7+
- 'v*'
68
pull_request:
79
paths-ignore:
810
- "*.md"

.github/workflows/release.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: 'Release tag (e.g., v1.2.3)'
10+
required: true
11+
type: string
12+
skip_ci_check:
13+
description: 'Skip CI status check'
14+
required: false
15+
type: boolean
16+
default: false
17+
18+
permissions:
19+
contents: write
20+
id-token: write
21+
22+
jobs:
23+
release:
24+
name: Release
25+
runs-on: ubuntu-latest
26+
environment: npm
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
32+
fetch-depth: 0
33+
34+
- name: Check CI status
35+
if: ${{ !inputs.skip_ci_check }}
36+
run: |
37+
# Check if CI has completed successfully for this commit
38+
RESULT=$(gh run list --commit ${{ github.sha }} --status success --json conclusion,workflowName | jq '.[]|select(.workflowName == "Install and test AVA")')
39+
if [ -z "$RESULT" ]; then
40+
echo "CI has not completed successfully for this commit"
41+
exit 1
42+
fi
43+
echo "All CI checks have passed!"
44+
env:
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Verify tag matches package.json version
48+
run: |
49+
PACKAGE_VERSION=$(jq -r '.version' package.json)
50+
TAG_VERSION=${RELEASE_TAG#v}
51+
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
52+
echo "Package version ($PACKAGE_VERSION) does not match tag version ($TAG_VERSION)"
53+
exit 1
54+
fi
55+
env:
56+
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
57+
58+
59+
- name: Setup Node.js
60+
uses: actions/setup-node@v4
61+
with:
62+
node-version-file: package.json
63+
cache: npm
64+
registry-url: https://registry.npmjs.org
65+
66+
- name: Publish to npm with provenance
67+
run: npm publish --provenance
68+
env:
69+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
70+
71+
- name: Create GitHub Release
72+
run: |
73+
gh release create "$RELEASE_TAG" \
74+
--title "$RELEASE_TAG" \
75+
--draft \
76+
--generate-notes
77+
env:
78+
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
79+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

maintaining.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,36 @@
77
## Testing
88

99
* `npm test`: Lint the code and run the entire test suite with coverage.
10-
* `npx tap test-tap/fork.js --bail`: Run a specific test file and bail on the first failure (useful when hunting bugs).
11-
* `npx test-ava test/{file}.js`: Run self-hosted tests.
10+
* `npx test-ava`: Run self-hosted tests from `test/`. Wraps a stable version of AVA.
11+
* `npx tap`: Run legacy tests from `test-tap/`.
12+
13+
Note that in CI we only run linting with the Node.js version set in the `package.json` file under the `"volta"` key.
1214

1315
## CI
1416

15-
* Tests sometimes fail on Windows. Review the errors carefully.
16-
* At least one Windows job must pass.
17-
* All other jobs must pass.
17+
We test across Linux, macOS and Windows, across all supported Node.js versions. The occasional failure in a specific environment is to be expected. If jobs fail, review carefully.
18+
19+
TypeScript jobs should all pass.
1820

1921
## Updating dependencies
2022

2123
* Make sure new dependency versions are compatible with our supported Node.js versions.
22-
* Leave the TypeScript dependency as it is, to avoid accidental breakage.
24+
* TypeScript dependency changes require CI changes to ensure backwards compatibility, see below.
2325
* Open a PR with the updates and only merge when CI passes (see the previous section).
2426

2527
## Updating TypeScript
2628

2729
TypeScript itself does not follow SemVer. Consequently we may have to make changes to the type definition that, technically, are breaking changes for users with an older TypeScript version. That's OK, but we should be aware.
2830

29-
Only update the TypeScript dependency when truly necessary. This helps avoid accidental breakage. For instance we won't accidentally rely on newer TypeScript features.
31+
When updating the TypeScript dependency, *also* add it to the CI workflow. This enables us to do typechecking with previous TypeScript versions and avoid unintentional breakage. For instance we won't accidentally rely on newer TypeScript features.
3032

3133
Speaking of, using newer TypeScript features could be considered a breaking change. This needs to be assessed on a case-by-case basis.
3234

3335
## Pull requests
3436

3537
* New features should come with tests and documentation.
3638
* Ensure the [contributing guidelines](.github/CONTRIBUTING.md) are followed.
37-
* Squash commits when merging.
39+
* Usually we squash commits when merging. Rebases may sometimes be appropriate.
3840

3941
## Experiments
4042

@@ -43,9 +45,12 @@ Speaking of, using newer TypeScript features could be considered a breaking chan
4345

4446
## Release process
4547

46-
* Update dependencies (see the previous section).
47-
* If [necessary](docs/support-statement.md), update the `engines` field in `package.json`.
48-
* Remove unsupported (or soon to be) Node.js versions.
49-
* When doing a major version bump, make sure to require the latest releases of each supported Node.js version.
50-
* Publish a new version using [`np`](https://github.com/sindresorhus/np) with a version number according to [SemVer](https://semver.org).
51-
* Write a [release note](https://github.com/avajs/ava/releases/new) following the style of previous release notes.
48+
* Use `npm version` with the correct increment and push the resulting tag and `main` branch.
49+
* CI will run against the tag. Wait for this to complete.
50+
* Approve the Release workflow within GitHub. The workflow includes npm provenance for enhanced security and supply chain transparency.
51+
52+
### Setup Requirements
53+
54+
For the automated workflows to work, the following secrets must be configured in the repository:
55+
56+
- `NPM_TOKEN`: An npm automation token with publish permissions to the AVA package, within the `npm` environment

0 commit comments

Comments
 (0)