Skip to content

Commit b3ae916

Browse files
committed
feat: added release action
1 parent d1e4749 commit b3ae916

6 files changed

Lines changed: 258 additions & 26 deletions

File tree

.github/actions/resource-push-ngc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
publish:
14-
runs-on: ubuntu-latest
14+
runs-on: linux-amd64-cpu4
1515
steps:
1616
- uses: actions/checkout@v4
1717
- name: Upload resource

.github/actions/trivy-scan/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ This allows the scan to run and complete without errors. Results won't appear in
5656
jobs:
5757
trivy-scan:
5858
name: Vulnerability Scan
59-
runs-on: ubuntu-latest
59+
runs-on: linux-amd64-cpu4
6060
permissions:
6161
actions: read
6262
contents: read
@@ -78,7 +78,7 @@ jobs:
7878
jobs:
7979
scan-container:
8080
name: Container Vulnerability Scan
81-
runs-on: ubuntu-latest
81+
runs-on: linux-amd64-cpu4
8282
permissions:
8383
actions: read
8484
contents: read
@@ -101,7 +101,7 @@ jobs:
101101
jobs:
102102
comprehensive-scan:
103103
name: Comprehensive Security Scan
104-
runs-on: ubuntu-latest
104+
runs-on: linux-amd64-cpu4
105105
permissions:
106106
actions: read
107107
contents: read
@@ -301,7 +301,7 @@ on:
301301
302302
jobs:
303303
daily-scan:
304-
runs-on: ubuntu-latest
304+
runs-on: linux-amd64-cpu4
305305
permissions:
306306
actions: read
307307
contents: read
@@ -323,7 +323,7 @@ on:
323323
324324
jobs:
325325
pr-scan:
326-
runs-on: ubuntu-latest
326+
runs-on: linux-amd64-cpu4
327327
permissions:
328328
actions: read
329329
contents: read
@@ -342,7 +342,7 @@ jobs:
342342
```yaml
343343
jobs:
344344
build:
345-
runs-on: ubuntu-latest
345+
runs-on: linux-amd64-cpu4
346346
outputs:
347347
image-tag: ${{ steps.meta.outputs.tags }}
348348
steps:
@@ -353,7 +353,7 @@ jobs:
353353
354354
scan:
355355
needs: build
356-
runs-on: ubuntu-latest
356+
runs-on: linux-amd64-cpu4
357357
permissions:
358358
actions: read
359359
contents: read
@@ -371,7 +371,7 @@ jobs:
371371
```yaml
372372
jobs:
373373
rust-security:
374-
runs-on: ubuntu-latest
374+
runs-on: linux-amd64-cpu4
375375
permissions:
376376
actions: read
377377
contents: read
@@ -391,7 +391,7 @@ jobs:
391391
```yaml
392392
jobs:
393393
secret-scan:
394-
runs-on: ubuntu-latest
394+
runs-on: linux-amd64-cpu4
395395
permissions:
396396
actions: read
397397
contents: read

.github/actions/trufflehog-scan/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ TruffleHog scans **git commit history** for:
3131
```yaml
3232
jobs:
3333
secret-scan:
34-
runs-on: ubuntu-latest
34+
runs-on: linux-amd64-cpu4
3535
steps:
3636
- uses: actions/checkout@v4
3737
with:
@@ -51,7 +51,7 @@ on:
5151

5252
jobs:
5353
trufflehog:
54-
runs-on: ubuntu-latest
54+
runs-on: linux-amd64-cpu4
5555
permissions:
5656
actions: read # For direct job URL links
5757
contents: read
@@ -77,7 +77,7 @@ on:
7777

7878
jobs:
7979
trufflehog:
80-
runs-on: ubuntu-latest
80+
runs-on: linux-amd64-cpu4
8181
steps:
8282
- uses: actions/checkout@v4
8383
with:
@@ -301,7 +301,7 @@ on: [push, pull_request]
301301

302302
jobs:
303303
secrets:
304-
runs-on: ubuntu-latest
304+
runs-on: linux-amd64-cpu4
305305
steps:
306306
- uses: actions/checkout@v4
307307
with:
@@ -320,7 +320,7 @@ on:
320320

321321
jobs:
322322
secrets:
323-
runs-on: ubuntu-latest
323+
runs-on: linux-amd64-cpu4
324324
permissions:
325325
actions: read # For direct job URL links
326326
contents: read
@@ -369,7 +369,7 @@ permissions:
369369

370370
jobs:
371371
security:
372-
runs-on: ubuntu-latest
372+
runs-on: linux-amd64-cpu4
373373
steps:
374374
- uses: actions/checkout@v4
375375
with:

.github/workflows/README.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
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)

.github/workflows/release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Release
16+
17+
on:
18+
push:
19+
branches:
20+
- main
21+
22+
permissions:
23+
contents: write # Create releases and tags
24+
issues: write # Comment on released issues
25+
pull-requests: write # Comment on released PRs
26+
27+
jobs:
28+
release:
29+
name: Semantic Release
30+
runs-on: ubuntu-latest # FIXME: Replace with NV Runners
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0 # Required for semantic-release
36+
persist-credentials: false
37+
38+
- name: Semantic Release
39+
id: semantic
40+
uses: ./.github/actions/semantic-release
41+
with:
42+
github-token: ${{ secrets.GITHUB_TOKEN }}
43+
tag-format: v${version}
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Update Major Version Tag
48+
if: steps.semantic.outputs.new-release-published == 'true'
49+
run: |
50+
NEW_VERSION="v${{ steps.semantic.outputs.new-release-version }}"
51+
MAJOR_VERSION="v${{ steps.semantic.outputs.new-release-major-version }}"
52+
53+
# Configure git
54+
git config user.name "github-actions[bot]"
55+
git config user.email "github-actions[bot]@users.noreply.github.com"
56+
57+
# Force update major version tag (e.g., v1 points to latest v1.x.x)
58+
git tag -fa "$MAJOR_VERSION" -m "Update $MAJOR_VERSION to $NEW_VERSION"
59+
git push origin "$MAJOR_VERSION" --force
60+
61+
echo "✅ Updated major version tag: $MAJOR_VERSION -> $NEW_VERSION"

0 commit comments

Comments
 (0)