This project uses automated versioning and publishing through GitHub Actions. Here's how it works:
We follow Semantic Versioning (SemVer) for all releases:
- MAJOR version when you make incompatible API changes (X.0.0)
- MINOR version when you add functionality in a backward compatible manner (0.X.0)
- PATCH version when you make backward compatible bug fixes (0.0.X)
The CI pipeline automatically determines the type of version change based on the commit messages:
- If any commit message contains "BREAKING CHANGE", a major version bump occurs
- If any commit message starts with "feat", a minor version bump occurs
- Otherwise, a patch version bump occurs
- Create a PR with your changes
- Ensure all tests pass in the CI workflow
- Merge the PR to the main branch
- The CI workflow automatically:
- Determines the version bump type
- Updates the package.json version
- Builds the library
- Publishes the new version to npm
- Creates a GitHub release
To ensure proper versioning, follow these commit message conventions:
feat: add new feature X
fix: resolve issue with Y
chore: update dependencies
feat: add new API endpoints
BREAKING CHANGE: removed deprecated methods
The CI/CD pipeline is implemented using a single GitHub Actions workflow:
-
Repository secrets needed:
NPM_TOKEN
: For publishing to npm
-
Workflow:
- CI Workflow (
.github/workflows/ci.yml
) handles both PR validation and publishing
- CI Workflow (
We use commitlint
and husky
to enforce conventional commit messages:
# Install dependencies
npm install --save-dev @commitlint/cli @commitlint/config-conventional husky
# Set up husky
npm run prepare # Creates the .husky directory
npx husky add .husky/commit-msg 'npx --no -- commitlint --edit ${1}'
If needed, you can trigger a manual release using our script:
node tools/scripts/create-release.mjs [patch|minor|major] [library-name]
If needed, you can trigger a manual release by:
- Updating the version in package.json
- Building the library:
npx nx build vite-plugin-use-electron
- Publishing to npm:
npx nx publish vite-plugin-use-electron --ver=X.Y.Z --tag=latest