This repository includes automated workflows for building, testing, and publishing the @mixcore/sdk-client
package to npm.
- Trigger: Pull requests and pushes to main branch
- Purpose: Runs tests, linting, type checking, and builds to ensure code quality
- Steps:
- Install dependencies
- Type checking
- Linting
- Build packages
- Run tests with coverage
- Trigger: Pushes to main branch (when changesets are present)
- Purpose: Automatically publishes packages to npm using changesets
- Features:
- Creates Release PRs when changesets are present
- Automatically publishes to npm when Release PRs are merged
- Generates changelogs
- Trigger: Manual workflow dispatch from GitHub Actions tab
- Purpose: Allows manual releases with version bump selection
- Options: patch, minor, or major version bumps
- Go to npmjs.com and log in
- Navigate to Access Tokens in your account settings
- Create a new "Automation" token with "Read and write" permissions
- In your GitHub repository, go to Settings → Secrets and variables → Actions
- Add a new repository secret named
NPM_TOKEN
with your npm token value
Ensure your repository has the following branch protection rules for main
:
- Require pull request reviews
- Require status checks to pass (CI workflow)
- Require up-to-date branches
- Create a changeset for your changes:
pnpm exec changeset
- Follow the prompts to select packages and version bump type
- Commit and push the changeset file
- The workflow will create a Release PR
- When the Release PR is merged, the package will be automatically published
- Go to the Actions tab in your GitHub repository
- Select "Manual Release" workflow
- Click "Run workflow"
- Choose the version bump type (patch/minor/major)
- The workflow will create a version bump and publish to npm
The package is configured with:
- Public access: Set in both
package.json
(publishConfig.access: "public"
) and changeset config - Build before publish: The
prepublishOnly
script ensures the package is built before publishing - Dist files: Only the
dist/
directory is included in the published package
- NPM Token Invalid: Ensure the
NPM_TOKEN
secret is set correctly and has write permissions - Build Failures: Check that all tests pass locally before pushing
- Changeset Issues: Ensure changeset files are properly formatted and committed
- Check the Actions tab for detailed logs
- Verify that all dependencies are properly installed
- Ensure the build process completes successfully locally
- The
NPM_TOKEN
secret is only accessible to workflow runs on the main branch - The workflows use the latest stable versions of actions with specific version pinning
- Dependencies are cached to improve performance and security