|
| 1 | +# GitHub Actions Workflows |
| 2 | + |
| 3 | +This repository uses a comprehensive set of GitHub Actions workflows for continuous integration, automated releases, and package publishing. |
| 4 | + |
| 5 | +## Workflows Overview |
| 6 | + |
| 7 | +### 🔍 CI Pipeline (`ci.yml`) |
| 8 | + |
| 9 | +**Triggers:** Pull requests and pushes to main/master branches |
| 10 | + |
| 11 | +**Features:** |
| 12 | + |
| 13 | +- **Smart Change Detection**: Only runs relevant jobs based on file changes |
| 14 | +- **Matrix Testing**: Tests across multiple Node.js versions (18, 20, 22) |
| 15 | +- **Parallel Jobs**: Runs lint, test, build, coverage, and audit in parallel |
| 16 | +- **Type Checking**: Validates both CJS and MJS TypeScript configurations |
| 17 | +- **Dependency Review**: Automatically reviews dependency changes in PRs |
| 18 | +- **Coverage Upload**: Uploads test coverage to Codecov |
| 19 | + |
| 20 | +**Jobs:** |
| 21 | + |
| 22 | +1. `changes` - Detects which files changed |
| 23 | +2. `quality` - Runs code quality checks (lint, test, build, coverage, audit) |
| 24 | +3. `compatibility` - Tests Node.js version compatibility |
| 25 | +4. `type-check` - TypeScript compilation checks |
| 26 | +5. `dependency-review` - Reviews new dependencies |
| 27 | +6. `status-check` - Aggregates all job results |
| 28 | + |
| 29 | +### 🚀 Release Pipeline (`bump.yml` → `publish.yml`) |
| 30 | + |
| 31 | +**Triggers:** |
| 32 | + |
| 33 | +- Automatic: Pushes to master branch |
| 34 | +- Manual: Workflow dispatch with version type selection |
| 35 | + |
| 36 | +**Features:** |
| 37 | + |
| 38 | +- **Semantic Versioning**: Auto-detects version bump based on commit messages |
| 39 | +- **Changelog Generation**: Automatically updates CHANGELOG.md |
| 40 | +- **GitHub Releases**: Creates GitHub releases with release notes |
| 41 | +- **Pre-release Support**: Handles alpha/beta/rc versions |
| 42 | + |
| 43 | +**Version Detection Rules:** |
| 44 | + |
| 45 | +- `BREAKING CHANGE` or `!:` in commits → Major version |
| 46 | +- `feat:` in commits → Minor version |
| 47 | +- Default → Patch version |
| 48 | + |
| 49 | +### 📦 Publish Pipeline (`publish.yml`) |
| 50 | + |
| 51 | +**Triggers:** Git tags starting with `v*` or GitHub releases |
| 52 | + |
| 53 | +**Features:** |
| 54 | + |
| 55 | +- **Environment Protection**: Uses npm-publish environment for security |
| 56 | +- **Dry Run Validation**: Tests publishing before actual publish |
| 57 | +- **Duplicate Check**: Prevents republishing existing versions |
| 58 | +- **Pre-release Tagging**: Correctly tags alpha/beta releases |
| 59 | +- **Documentation Updates**: Generates and deploys docs for stable releases |
| 60 | + |
| 61 | +### 🔄 Dependency Updates (`deps.yml`) |
| 62 | + |
| 63 | +**Triggers:** |
| 64 | + |
| 65 | +- Weekly schedule (Mondays) |
| 66 | +- Manual trigger |
| 67 | + |
| 68 | +**Features:** |
| 69 | + |
| 70 | +- **Automated Updates**: Updates all dependencies |
| 71 | +- **Security Fixes**: Applies npm audit fixes |
| 72 | +- **PR Creation**: Creates pull requests for review |
| 73 | +- **Test Validation**: Ensures updates don't break tests |
| 74 | + |
| 75 | +### 🌙 Nightly Tests (`nightly.yml`) |
| 76 | + |
| 77 | +**Triggers:** |
| 78 | + |
| 79 | +- Daily at 2 AM UTC |
| 80 | +- Manual trigger |
| 81 | + |
| 82 | +**Features:** |
| 83 | + |
| 84 | +- **Cross-Platform Testing**: Tests on Ubuntu, Windows, macOS |
| 85 | +- **Extended Coverage**: Full test suite with coverage reporting |
| 86 | +- **Performance Benchmarks**: Tracks performance over time |
| 87 | +- **Security Scanning**: Vulnerability scanning with Trivy |
| 88 | + |
| 89 | +## Setup Requirements |
| 90 | + |
| 91 | +### Repository Secrets |
| 92 | + |
| 93 | +Add these secrets in GitHub repository settings: |
| 94 | + |
| 95 | +``` |
| 96 | +NPM_TOKEN - NPM publishing token |
| 97 | +CODECOV_TOKEN - Codecov upload token (optional) |
| 98 | +``` |
| 99 | + |
| 100 | +### Repository Settings |
| 101 | + |
| 102 | +1. **Environments**: Create `npm-publish` environment for publish protection |
| 103 | +2. **Branch Protection**: Enable required status checks on main/master |
| 104 | +3. **Actions Permissions**: Allow GitHub Actions to create and approve pull requests |
| 105 | + |
| 106 | +### NPM Setup |
| 107 | + |
| 108 | +1. Create NPM account and organization |
| 109 | +2. Generate automation token with publish permissions |
| 110 | +3. Add token as `NPM_TOKEN` secret |
| 111 | + |
| 112 | +## Usage Examples |
| 113 | + |
| 114 | +### Manual Release |
| 115 | + |
| 116 | +```bash |
| 117 | +# Trigger manual release with specific version type |
| 118 | +gh workflow run bump.yml -f version-type=minor |
| 119 | +``` |
| 120 | + |
| 121 | +### Emergency Publish |
| 122 | + |
| 123 | +```bash |
| 124 | +# Push tag to trigger immediate publish |
| 125 | +git tag v1.2.3 |
| 126 | +git push origin v1.2.3 |
| 127 | +``` |
| 128 | + |
| 129 | +### Dependency Updates |
| 130 | + |
| 131 | +```bash |
| 132 | +# Trigger dependency update check |
| 133 | +gh workflow run deps.yml |
| 134 | +``` |
| 135 | + |
| 136 | +## Commit Message Conventions |
| 137 | + |
| 138 | +Follow [Conventional Commits](https://www.conventionalcommits.org/) for automatic version detection: |
| 139 | + |
| 140 | +```bash |
| 141 | +# Patch version (1.0.0 → 1.0.1) |
| 142 | +fix: resolve parser error in EmptyLine |
| 143 | + |
| 144 | +# Minor version (1.0.0 → 1.1.0) |
| 145 | +feat: add new Table component |
| 146 | + |
| 147 | +# Major version (1.0.0 → 2.0.0) |
| 148 | +feat!: remove deprecated Block interface |
| 149 | +BREAKING CHANGE: Block interface removed |
| 150 | + |
| 151 | +# Pre-release |
| 152 | +feat: add experimental features (1.0.0 → 1.1.0-alpha.1) |
| 153 | +``` |
| 154 | + |
| 155 | +## Monitoring |
| 156 | + |
| 157 | +- **Actions Tab**: View workflow runs and logs |
| 158 | +- **Releases**: Track published versions |
| 159 | +- **Security Tab**: Review vulnerability scans |
| 160 | +- **Insights**: Analyze dependency updates and security alerts |
| 161 | + |
| 162 | +## Best Practices |
| 163 | + |
| 164 | +1. **Always use semantic commit messages** for automatic versioning |
| 165 | +2. **Review dependency update PRs** before merging |
| 166 | +3. **Monitor nightly test results** for early issue detection |
| 167 | +4. **Use draft releases** for pre-release testing |
| 168 | +5. **Enable branch protection** to require CI passes before merge |
| 169 | + |
| 170 | +## Troubleshooting |
| 171 | + |
| 172 | +### Failed Publishes |
| 173 | + |
| 174 | +- Check NPM_TOKEN validity |
| 175 | +- Verify version isn't already published |
| 176 | +- Review package.json configuration |
| 177 | + |
| 178 | +### CI Failures |
| 179 | + |
| 180 | +- Check Node.js version compatibility |
| 181 | +- Review dependency conflicts |
| 182 | +- Validate TypeScript configuration |
| 183 | + |
| 184 | +### Version Bumps Not Working |
| 185 | + |
| 186 | +- Verify commit message format |
| 187 | +- Check branch protection settings |
| 188 | +- Ensure GITHUB_TOKEN permissions |
0 commit comments