An open API service indexing awesome lists of open source software.

https://github.com/mixcore/sdk-client


https://github.com/mixcore/sdk-client

Last synced: about 1 year ago
JSON representation

Awesome Lists containing this project

README

          

# GitHub Actions Setup for @mixcore/sdk-client

This repository includes automated workflows for building, testing, and publishing the `@mixcore/sdk-client` package to npm.

## Workflows

### 1. CI Workflow (`ci.yml`)
- **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

### 2. Release Workflow (`release.yml`)
- **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

### 3. Manual Release Workflow (`manual-release.yml`)
- **Trigger**: Manual workflow dispatch from GitHub Actions tab
- **Purpose**: Allows manual releases with version bump selection
- **Options**: patch, minor, or major version bumps

## Setup Instructions

### 1. NPM Token Setup
1. Go to [npmjs.com](https://www.npmjs.com) and log in
2. Navigate to Access Tokens in your account settings
3. Create a new "Automation" token with "Read and write" permissions
4. In your GitHub repository, go to Settings → Secrets and variables → Actions
5. Add a new repository secret named `NPM_TOKEN` with your npm token value

### 2. Repository Configuration
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

## Usage

### Automated Releases (Recommended)
1. Create a changeset for your changes:
```bash
pnpm exec changeset
```
2. Follow the prompts to select packages and version bump type
3. Commit and push the changeset file
4. The workflow will create a Release PR
5. When the Release PR is merged, the package will be automatically published

### Manual Releases
1. Go to the Actions tab in your GitHub repository
2. Select "Manual Release" workflow
3. Click "Run workflow"
4. Choose the version bump type (patch/minor/major)
5. The workflow will create a version bump and publish to npm

## Package Configuration

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

## Troubleshooting

### Common Issues
1. **NPM Token Invalid**: Ensure the `NPM_TOKEN` secret is set correctly and has write permissions
2. **Build Failures**: Check that all tests pass locally before pushing
3. **Changeset Issues**: Ensure changeset files are properly formatted and committed

### Debugging
- Check the Actions tab for detailed logs
- Verify that all dependencies are properly installed
- Ensure the build process completes successfully locally

## Security Notes
- 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