Skip to content

Commit d4968c6

Browse files
authored
build: Scripts to manage release process (#3)
* ci: Write release scripts * Update package version to 0.0.beta.0 and fix check:pr-version * build: Replace .dev- git sha by hour git sha do not match with the upcoming commit. On top of that, they are not historically sortable. By using the yyyymmddhhmmss format, we know their order of releases. * build: Add release:local script * build: Add build script to release:dev and relase:main * Release 0.1.0-dev.20230517211625 (first release) * build: gitignore - Add package * build: Include src/tests in the release output * Release 0.1.0-dev.20230517215258 * build(askForConfirmation): Change to y/n and pass missing question * build: Script to lint package version + revert back to main * build: Revert pr_dev_version to not use git cmds because it fails in CI * build: Revert back to 0.0.0 * docs: Fix package name
1 parent ceb6f47 commit d4968c6

13 files changed

+944
-260
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ jobs:
5959
- name: Lint
6060
run: npm run lint
6161
- run: npm run prettier:check
62+
- run: npm run check:pr-version

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ coverage
2525

2626
# Build Files
2727
dist
28+
*.tgz
29+
# from unzipping .tgz
30+
package

CONTRIBUTING.md

Lines changed: 87 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,107 @@
44

55
If you have questions about the library, found a bug or want to suggest a feature, please create an issue.
66

7-
## Development
7+
## Documentation
88

9-
- Install dependencies:
9+
You can visit the [docs website](https://json-schema-form.vercel.app/), however its source is not in the repo yet, only the build (`/docs_build`). Our docs are still coupled to Remote's internal Design System and integration tests. The effort to decouple it at the moment is too high.
10+
11+
So our strategy is to at each new PR, to update the docs internally and manually copy its build to this repo.
12+
13+
## Setup
14+
15+
- Install the dependencies:
1016

1117
```bash
1218
npm ci
1319
```
1420

15-
- Run tests:
21+
- Run the tests:
1622

1723
```
1824
npm test
1925
```
2026

21-
### Documentation
27+
## Development workflow
2228

23-
You can visit the [docs website](https://json-schema-form.vercel.app/), however its source is not in the repo yet, only the build (`/docs_build`). Our docs are still coupled to Remote's internal Design System and integration tests. The effort to decouple it at the moment is too high.
29+
### Creating a new branch
2430

25-
So our strategy is to at each new PR, to update the docs internally and manually copy its build to this repo.
31+
Submit your branch pointing to `main`.
32+
33+
Please, always add tests to your bug fixs and new features.
34+
35+
### Testing the PR in your project
36+
37+
#### Local release
38+
39+
The simplest way to test your PR in your project is by installing it locally as a "tarball" version.
40+
41+
1. Run `npm run release:local`, which will create the tarball. It will output a suggest npm command to re-install the package in your project. Example:
42+
43+
```
44+
npm un @remoteoss/json-schema-form && npm i -S /Users/kim/Documents/my-repos/json-schema-form/local-0.1.0-beta.0.tgz
45+
```
46+
47+
2. Then go to your project and run the command above.
48+
49+
You can re-run this `release:local` as many times as you need. Remember to re-install the package each time a new tarball is created.
50+
51+
#### Public release
52+
53+
If you need a public release (for example, to run it on your project CI), you can publish a `dev` release.
54+
55+
Note that only core maintainers (Remoters) can publish public releases. If needed, ask us in the PR and we'll do it for you. Check #3 for the video walkthrough.
56+
57+
1. Locally run the script `npm run release:dev:patch` or `npm run release:dev:minor` depending on your changes.
58+
a. You'll be shown what's the new version and prompt you if it's correct. Eg
59+
60+
```
61+
Creating a new dev...
62+
:: Current version: 1.0.0
63+
:::::: New version: 1.0.1-dev.20230516175718
64+
Ready to commit and publish it? (y/n)
65+
66+
```
67+
68+
b. Then it will ask for the `@remoteoss` OTP for the NPM access to publish it.
69+
c. Done! 🎉
70+
71+
Every `dev` release is [tagged as `dev`](https://docs.npmjs.com/cli/v9/commands/npm-publish#tag), which means it won't be automatically installed in your project by default.
72+
You must specify the exact version, for example:
73+
74+
```bash
75+
npm i -S @remoteoss/[email protected]
76+
```
77+
78+
You can create as many dev releases as you need during the PRs, by running the same command.
79+
80+
### Merging a PR
81+
82+
A PR needs all CI checks to pass.
83+
84+
By default, prefer to "Squash and Merge" giving it a message that follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
85+
86+
The final release is done after merge.
87+
88+
### Publishing a stable release
89+
90+
1. Checkout `main` and pull the latest commit
91+
2. Depending if you want a `path` or `minor`, run the command `npm release:main:patch` or `npm release:main:minor`.
92+
93+
a. You'll be shown what's the new version and prompt you if it's correct. Eg
2694

27-
## Pull requests (PR)
95+
```
96+
Creating a new dev...
97+
:: Current version: 1.0.0-beta.0
98+
:::::: New version: 1.1.0-beta.0
99+
Ready to commit and publish it? (y/n)
28100

29-
Maintainers merge PRs by squashing the commits and editing the merge commit message using [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
101+
```
30102

31-
## Releases
103+
b. Then it will update the CHANGELOG using [generate-changelog](https://github.com/lob/generate-changelog). You may change it if needed, before going to the next step.
104+
c. Finally, it will ask for the `@remoteoss` OTP for the NPM access to publish it.
105+
d. Done! A new release is [published on NPM](https://www.npmjs.com/package/@remoteoss/json-schema-form)! 🎉
32106

33-
For each new PR merged, a GitHub action is triggered to create a new release.
107+
3. Create [a new Github Release](https://github.com/remoteoss/json-schema-form/releases/new).
108+
- Choose the tag matching the newest version.
109+
- The title is the version eg "v1.0.0-beta.0"
110+
- Copy the new part of the CHANGELOG to the description.

docs_build/main.d9d68168.iframe.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)