Skip to content

Commit 63110da

Browse files
authored
Merge pull request #191 from brionmario/refactor-i18n
docs: update CONTRIBUTING guide with changesets
2 parents 7b27ac2 + c568179 commit 63110da

File tree

1 file changed

+170
-0
lines changed

1 file changed

+170
-0
lines changed

CONTRIBUTING.md

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ This guide walks you through setting up the development environment and other im
2626
- [Option 2: Integrate into an existing sample](#option-2-integrate-into-an-existing-sample)
2727
- [Testing with AsgardeoProvider](#testing-with-asgardeoprovider)
2828
- [Update documentation](#update-documentation)
29+
- [Releases](#releases)
30+
- [Creating a Changeset](#creating-a-changeset)
31+
- [Step-by-step process](#step-by-step-process)
32+
- [For Maintainers](#for-maintainers)
33+
- [Release Process](#release-process)
34+
- [Release Automation](#release-automation)
2935
- [Contributing to the Documentation](#contributing-to-the-documentation)
3036

3137
## Prerequisite Software
@@ -319,6 +325,170 @@ For right-to-left languages, ensure that the UI layout adjusts correctly based o
319325

320326
Update any relevant documentation to mention the newly supported language.
321327

328+
### Releases
329+
330+
This project uses [🦋 Changesets](https://github.com/changesets/changesets) for version management and release automation. As an external contributor, you'll primarily interact with the changeset system when your changes need to be included in a release.
331+
332+
#### Creating a Changeset
333+
334+
Whenever you make changes that should be included in a release (new features, bug fixes, breaking changes), you must create a changeset. This helps maintainers understand what changed and how to version your contribution appropriately.
335+
336+
**When do you need a changeset?**
337+
338+
- ✅ Adding new features
339+
- ✅ Fixing bugs
340+
- ✅ Making breaking changes
341+
- ✅ Performance improvements
342+
343+
**When you don't need a changeset?**
344+
345+
- ❌ Documentation-only changes
346+
- ❌ Internal refactoring that doesn't affect the public API
347+
- ❌ Test-only changes
348+
349+
##### Step-by-step process
350+
351+
1. **Run the changeset command** in your terminal from the root of the project:
352+
353+
```bash
354+
pnpm changeset
355+
```
356+
357+
2. **Select the packages** that your changes affect:
358+
359+
- Use the arrow keys to navigate through the list
360+
- Press space to select/deselect packages
361+
- Press Enter to confirm your selection
362+
363+
> [!IMPORTANT]
364+
> ⚠️ Pick only the packages that you have changed files in. If the package is used by different packages, those packages will automatically get a version bump if needed.
365+
366+
3. **Choose the type of change** for each selected package:
367+
368+
> [!IMPORTANT]
369+
> ⚠️ Since we are still in the early stages of development, we are only doing **patch** releases for now. Please select "patch" for now until further notice.
370+
371+
- **Patch** (0.0.X) - Bug fixes and non-breaking changes
372+
- **Minor** (0.X.0) - New features that don't break existing functionality
373+
- **Major** (X.0.0) - Breaking changes that require users to update their code
374+
375+
4. **Write a clear summary** of your changes:
376+
377+
- Use present tense (e.g., "Add new authentication method")
378+
- Be descriptive and user-focused
379+
- Mention any breaking changes clearly
380+
- Focus on what users will experience, not implementation details
381+
382+
5. **Commit the changeset file** along with your changes:
383+
384+
```bash
385+
git add .changeset/
386+
git commit -m "chore: add changeset 🦋"
387+
```
388+
389+
**Example changeset summary:**
390+
391+
> [!NOTE]
392+
> This is an example changeset summary.
393+
> Changes are made for:
394+
> - `@asgardeo/javascript`
395+
> - `@asgardeo/react`
396+
> - `@asgardeo/i18n`
397+
> Even though there are other packages depending on these, only include the packages you directly modified.
398+
399+
````md
400+
---
401+
'@asgardeo/javascript': patch
402+
'@asgardeo/react': patch
403+
'@asgardeo/i18n': patch
404+
---
405+
406+
Update the react package to add a new `SignInWithPopup` method for popup-based authentication flows.
407+
408+
- This method allows users to sign in without redirecting, improving user experience.
409+
- Ensure to handle popup blockers and errors gracefully.
410+
411+
**Usage:**
412+
413+
```javascript
414+
import { SignInWithPopup } from '@asgardeo/react';
415+
416+
function App() {
417+
const handleSignIn = () => {
418+
SignInWithPopup()
419+
.then((user) => {
420+
console.log('User signed in:', user);
421+
})
422+
.catch((error) => {
423+
console.error('Error signing in:', error);
424+
});
425+
};
426+
427+
return (
428+
<div>
429+
<h1>Welcome to My App</h1>
430+
<button onClick={handleSignIn}>Sign In with Popup</button>
431+
</div>
432+
);
433+
}
434+
```
435+
436+
**Upgrade Notes:**
437+
438+
- Ensure your application can handle popup blockers.
439+
````
440+
441+
> [!TIP]
442+
> The changeset file will be automatically named and placed in the `.changeset/` directory. Don't edit these files manually after creation.
443+
444+
> [!IMPORTANT]
445+
> **Include your changeset in the same PR** as your code changes. PRs without changesets (when required) may be rejected during review.
446+
447+
#### For Maintainers
448+
449+
This section contains information relevant to project maintainers who handle the actual release process.
450+
451+
##### Release Process
452+
453+
The release process is fully automated and triggered by maintainers:
454+
455+
1. **Prerequisites for releases:**
456+
457+
- Maintainer permissions on the repository
458+
- NPM publish permissions for the `@asgardeo` organization
459+
- All PRs with changesets have been merged
460+
- Code review and testing completed
461+
462+
2. **Automatic release workflow:**
463+
464+
- When changesets are merged to `main`, a GitHub Action creates/updates a "Release" PR (ex: `[Release] [GitHub Action] Update package versions`).
465+
- The Release PR includes version bumps and generated changelogs
466+
- Maintainers review and merge the Release PR
467+
- Merging triggers automatic NPM publishing and GitHub releases
468+
469+
##### Release Automation
470+
471+
The project includes automated release infrastructure:
472+
473+
**GitHub Actions workflow** (`.github/workflows/release.yml`):
474+
475+
- Triggers on pushes to `main` branch
476+
- Creates release PRs using Changesets
477+
- Publishes packages to NPM when release PR is merged
478+
- Authenticates using `NPM_TOKEN` and `ASGARDEO_GITHUB_BOT_TOKEN` secrets
479+
480+
**Available scripts for maintainers:**
481+
482+
- `pnpm version:packages` - Updates versions and installs dependencies
483+
- `pnpm publish:packages` - Publishes all packages to NPM
484+
- `pnpm aggregate-changelogs` - Aggregates individual package changelogs
485+
486+
> [!IMPORTANT]
487+
> **Manual releases are strongly discouraged**. Always use the automated workflow to ensure consistency and prevent human errors.
488+
489+
> [!NOTE]
490+
> For pre-releases or special cases, use the `workflow_dispatch` trigger in the GitHub Actions workflow and coordinate with other maintainers.
491+
322492
### Contributing to the Documentation
323493

324494
The documentation for Asgardeo JavaScript SDKs is maintained in the Asgardeo / WSO2 Identity Server Official Docs site.

0 commit comments

Comments
 (0)