This directory contains GitHub Actions workflows for automated CI/CD.
To enable automatic npm publishing, you need to set up an NPM_TOKEN secret in your GitHub repository:
- Go to npmjs.com and log in
- Click on your profile → "Access Tokens"
- Click "Generate New Token" → "Granular Access Token"
- Configure the token:
- Token name:
syncrostate-github-actions - Expiration: Set to your preference (e.g., 1 year)
- Packages and scopes: Select your
syncrostatepackage - Permissions:
Read and writefor the packageReadfor organization (if applicable)
- Token name:
- Go to your GitHub repository
- Navigate to Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name:
NPM_TOKEN - Value: Paste the token you created from npm
- Click "Add secret"
The publish.yml workflow will:
- Trigger: Automatically run when code is pushed to
masterormainbranch - Version Check: Compare current package version with published version on npm
- Build & Test: Run tests and build the package
- Publish: Only publish if the version number has changed
- Release: Create a GitHub release with the new version tag
You can also trigger the workflow manually:
- Go to Actions tab in your GitHub repository
- Select "Publish to NPM" workflow
- Click "Run workflow" button
To publish a new version:
- Update the version in
package/package.json - Update the
CHANGELOG.mdwith new changes - Commit and push to master/main branch
- The workflow will automatically detect the version change and publish
- The NPM_TOKEN is stored securely as a GitHub secret
- The workflow only publishes when the version number changes
- Tests must pass before publishing
- The workflow runs in an isolated environment