|
| 1 | +# Workflows |
| 2 | + |
| 3 | +This directory contains automated workflows for the dsx-github-actions repository. |
| 4 | + |
| 5 | +## Release Workflow (`release.yml`) |
| 6 | + |
| 7 | +Automatically creates semantic version tags and releases when commits are pushed to the `main` branch using [semantic-release](https://github.com/semantic-release/semantic-release). |
| 8 | + |
| 9 | +### How It Works |
| 10 | + |
| 11 | +1. **Triggers**: On every push to `main` branch |
| 12 | +2. **Uses Semantic Release**: Leverages industry-standard semantic-release tool |
| 13 | +3. **Analyzes Commits**: Uses [Conventional Commits](https://www.conventionalcommits.org/) to determine version bump |
| 14 | +4. **Creates Tags**: Generates semantic version tags (e.g., `v1.2.3`) |
| 15 | +5. **Updates Major Tags**: Maintains major version tags (e.g., `v1`) for easy pinning |
| 16 | +6. **Creates Release**: Generates GitHub release with auto-generated release notes |
| 17 | + |
| 18 | +This workflow uses the `semantic-release` action from this repository (`./.github/actions/semantic-release`). |
| 19 | + |
| 20 | +### Conventional Commits |
| 21 | + |
| 22 | +The workflow follows conventional commit format to determine version bumps: |
| 23 | + |
| 24 | +#### Major Version (Breaking Changes) |
| 25 | + |
| 26 | +``` |
| 27 | +feat!: remove deprecated parameter |
| 28 | +BREAKING CHANGE: old parameter no longer works |
| 29 | +``` |
| 30 | + |
| 31 | +**Result**: `v1.0.0` → `v2.0.0` |
| 32 | + |
| 33 | +#### Minor Version (New Features) |
| 34 | + |
| 35 | +``` |
| 36 | +feat: add new post-pr-comment parameter |
| 37 | +feature(codeql): support multiple languages |
| 38 | +``` |
| 39 | + |
| 40 | +**Result**: `v1.0.0` → `v1.1.0` |
| 41 | + |
| 42 | +#### Patch Version (Bug Fixes, etc.) |
| 43 | + |
| 44 | +``` |
| 45 | +fix: resolve SARIF file not found issue |
| 46 | +docs: update README |
| 47 | +refactor: improve error handling |
| 48 | +chore: update dependencies |
| 49 | +``` |
| 50 | + |
| 51 | +**Result**: `v1.0.0` → `v1.0.1` |
| 52 | + |
| 53 | +### Version Tags |
| 54 | + |
| 55 | +The workflow creates two types of tags: |
| 56 | + |
| 57 | +1. **Full Version Tags** (e.g., `v1.2.3`) |
| 58 | + |
| 59 | + - Immutable, never changes |
| 60 | + - Use for production stability |
| 61 | + |
| 62 | +2. **Major Version Tags** (e.g., `v1`) |
| 63 | + - Points to latest minor/patch within major version |
| 64 | + - Automatically updated with new releases |
| 65 | + - Use for automatic updates within major version |
| 66 | + |
| 67 | +### Usage Examples |
| 68 | + |
| 69 | +**Pin to specific version** (recommended for production): |
| 70 | + |
| 71 | +```yaml |
| 72 | +uses: NVIDIA/dsx-github-actions/.github/actions/codeql-scan@v1.2.3 |
| 73 | +``` |
| 74 | +
|
| 75 | +**Pin to major version** (get latest patches/features): |
| 76 | +
|
| 77 | +```yaml |
| 78 | +uses: NVIDIA/dsx-github-actions/.github/actions/codeql-scan@v1 |
| 79 | +``` |
| 80 | +
|
| 81 | +**Use latest** (for development/testing): |
| 82 | +
|
| 83 | +```yaml |
| 84 | +uses: NVIDIA/dsx-github-actions/.github/actions/codeql-scan@main |
| 85 | +``` |
| 86 | +
|
| 87 | +### Manual Release |
| 88 | +
|
| 89 | +If you need to create a release manually: |
| 90 | +
|
| 91 | +1. **Tag locally**: |
| 92 | +
|
| 93 | + ```bash |
| 94 | + git tag -a v1.0.0 -m "Release v1.0.0" |
| 95 | + git push origin v1.0.0 |
| 96 | + ``` |
| 97 | + |
| 98 | +2. **The workflow will skip** if the tag already exists |
| 99 | + |
| 100 | +### Changelog Generation |
| 101 | + |
| 102 | +The workflow automatically generates changelogs organized by: |
| 103 | + |
| 104 | +- ✨ **Features**: New capabilities |
| 105 | +- 🐛 **Bug Fixes**: Fixes and corrections |
| 106 | +- 🔧 **Other Changes**: Docs, refactoring, etc. |
| 107 | + |
| 108 | +### Troubleshooting |
| 109 | + |
| 110 | +#### No tag created |
| 111 | + |
| 112 | +**Cause**: No commits since last tag |
| 113 | +**Solution**: This is expected behavior |
| 114 | + |
| 115 | +#### Wrong version bump |
| 116 | + |
| 117 | +**Cause**: Commit messages don't follow conventional commits |
| 118 | +**Solution**: Use proper commit format: |
| 119 | + |
| 120 | +- `feat:` for features |
| 121 | +- `fix:` for bug fixes |
| 122 | +- Add `!` or `BREAKING CHANGE:` for major bumps |
| 123 | + |
| 124 | +#### Tag already exists |
| 125 | + |
| 126 | +**Cause**: Tag was manually created |
| 127 | +**Solution**: Delete tag and re-push, or let workflow handle versioning |
| 128 | + |
| 129 | +## Best Practices |
| 130 | + |
| 131 | +1. **Use Conventional Commits**: Always follow the format for automatic versioning |
| 132 | +2. **Review Before Merge**: Check commit messages before merging to main |
| 133 | +3. **Breaking Changes**: Clearly mark with `!` or `BREAKING CHANGE:` footer |
| 134 | +4. **Descriptive Messages**: Write clear commit messages for better changelogs |
| 135 | + |
| 136 | +## Examples |
| 137 | + |
| 138 | +### Good Commit Messages |
| 139 | + |
| 140 | +``` |
| 141 | +feat(codeql-scan): add support for C++ language |
| 142 | +fix(trivy-scan): resolve SARIF file parsing error |
| 143 | +docs: update README with new examples |
| 144 | +refactor(codeql-scan): improve PR comment formatting |
| 145 | +``` |
| 146 | + |
| 147 | +### Breaking Change Example |
| 148 | + |
| 149 | +``` |
| 150 | +feat(codeql-scan)!: change default build-mode to none |
| 151 | +
|
| 152 | +BREAKING CHANGE: The default build-mode is now 'none' instead of 'autobuild'. |
| 153 | +Users must explicitly set build-mode: 'autobuild' if they want the previous behavior. |
| 154 | +``` |
| 155 | + |
| 156 | +## References |
| 157 | + |
| 158 | +- [Conventional Commits Specification](https://www.conventionalcommits.org/) |
| 159 | +- [Semantic Versioning](https://semver.org/) |
| 160 | +- [GitHub Actions: Creating releases](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository) |
0 commit comments