Skip to content

Commit e4de438

Browse files
committed
ci: Update release workflow to include changelog and docs
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
1 parent a63453d commit e4de438

File tree

5 files changed

+137
-384
lines changed

5 files changed

+137
-384
lines changed

.github/workflows/_release_library.yml

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ on:
3838
description: Create a GitHub release
3939
type: boolean
4040
default: true
41+
gh-release-use-changelog-builder:
42+
required: false
43+
description: Use release-changelog-builder-action to dynamically build changelog
44+
type: boolean
45+
default: false
46+
gh-release-changelog-config:
47+
required: false
48+
description: Path to changelog builder configuration file
49+
type: string
50+
default: ".github/workflows/config/changelog-config.json"
51+
gh-release-from-tag:
52+
required: false
53+
description: Starting tag for changelog builder (leave empty for auto-detect)
54+
type: string
55+
default: ""
4156
secrets:
4257
TWINE_USERNAME:
4358
required: true
@@ -345,12 +360,51 @@ jobs:
345360
ref: ${{ inputs.release-ref }}
346361
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
347362

363+
- name: Determine fromTag for changelog
364+
id: determine-from-tag
365+
if: inputs.gh-release-use-changelog-builder == true
366+
run: |
367+
cd ${{ github.run_id }}
368+
369+
# If gh-release-from-tag is provided, use it
370+
if [[ -n "${{ inputs.gh-release-from-tag }}" ]]; then
371+
FROM_TAG="${{ inputs.gh-release-from-tag }}"
372+
echo "Using provided fromTag: $FROM_TAG"
373+
else
374+
# Get the most recent tag
375+
FROM_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
376+
if [[ -z "$FROM_TAG" ]]; then
377+
echo "No previous tags found, leaving fromTag empty"
378+
else
379+
echo "Auto-detected most recent tag: $FROM_TAG"
380+
fi
381+
fi
382+
383+
echo "from-tag=$FROM_TAG" >> $GITHUB_OUTPUT
384+
385+
- name: Build Changelog
386+
id: build-changelog
387+
if: inputs.gh-release-use-changelog-builder == true
388+
uses: mikepenz/release-changelog-builder-action@v6.1.0
389+
env:
390+
GITHUB_TOKEN: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
391+
with:
392+
configuration: ${{ github.run_id }}/${{ inputs.gh-release-changelog-config }}
393+
owner: ${{ github.repository_owner }}
394+
repo: ${{ github.event.repository.name }}
395+
ignorePreReleases: "false"
396+
failOnError: "false"
397+
fromTag: ${{ steps.determine-from-tag.outputs.from-tag }}
398+
toTag: ${{ inputs.release-ref }}
399+
mode: ${{ inputs.gh-release-changelog-mode }}
400+
348401
- name: Create release
349402
id: version-number
350403
env:
351404
SHA: ${{ inputs.release-ref }}
352405
GH_TOKEN: ${{ secrets.PAT }}
353406
IS_DRY_RUN: ${{ inputs.dry-run }}
407+
BUILT_CHANGELOG: ${{ steps.build-changelog.outputs.changelog }}
354408
run: |
355409
cd ${{ github.run_id }}
356410
@@ -359,7 +413,10 @@ jobs:
359413
IS_PRERELEASE=$([[ "$IS_RELEASE_CANDIDATE" == "true" || "$IS_ALPHA" == "true" ]] && echo "true" || echo "false")
360414
NAME="NVIDIA $PROJECT_NAME ${VERSION}"
361415
362-
if [[ "$IS_RELEASE_CANDIDATE" == "true" ]]; then
416+
# Use built changelog if available, otherwise fall back to CHANGELOG.md
417+
if [[ -n "$BUILT_CHANGELOG" ]]; then
418+
CHANGELOG="$BUILT_CHANGELOG"
419+
elif [[ "$IS_RELEASE_CANDIDATE" == "true" ]]; then
363420
DATE=$(date +"%Y-%m-%d")
364421
CHANGELOG="Prerelease: $NAME ($DATE)"
365422
else
@@ -402,6 +459,16 @@ jobs:
402459
eval "$CMD"
403460
fi
404461
462+
publish-docs:
463+
needs: [bump-next-version, create-gh-release]
464+
uses: ./.github/workflows/release-docs.yml
465+
with:
466+
dry-run: ${{ inputs.dry-run }}
467+
publish-as-latest: true
468+
docs-version-override: ${{ needs.bump-next-version.outputs.release-version }}
469+
build-docs-ref: ${{ inputs.release-ref }}
470+
secrets: inherit
471+
405472
notify:
406473
needs: [build-test-publish-wheels, create-gh-release]
407474
runs-on: ubuntu-latest
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"categories": [],
3+
"ignore_labels": [
4+
"ignore"
5+
],
6+
"sort": "ASC",
7+
"template": "\n${{CHANGELOG}}\n\n<details><summary>Changelog Details</summary>\n\n${{UNCATEGORIZED}}\n</details>\n",
8+
"pr_template": "- ${{TITLE}} by @${{AUTHOR}} :: PR: #${{NUMBER}}",
9+
"commit_template": "- ${{TITLE}} by @${{AUTHOR}}",
10+
"empty_template": "${{OWNER}}\n${{REPO}}\n${{FROM_TAG}}\n${{TO_TAG}}",
11+
"duplicate_filter": {
12+
"pattern": ".+",
13+
"on_property": "title",
14+
"method": "match"
15+
},
16+
"transformers": [],
17+
"max_tags_to_fetch": 100,
18+
"max_pull_requests": 500,
19+
"max_back_track_time_days": 365,
20+
"exclude_merge_branches": [],
21+
"tag_resolver": {
22+
"method": "semver"
23+
}
24+
}

.github/workflows/release-docs.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,38 @@ on:
3434
description: Email addresses to send the notification to. Format as "me@me.com,you@you.com".
3535
required: false
3636
type: string
37+
build-docs-ref:
38+
description: Reference to build the docs from
39+
required: false
40+
type: string
41+
default: ${{ github.sha }}
42+
workflow_call:
43+
inputs:
44+
dry-run:
45+
description: Whether to run the workflow in dry-run mode
46+
required: true
47+
type: boolean
48+
default: true
49+
publish-as-latest:
50+
description: Publish as Latest stable version.
51+
required: false
52+
type: boolean
53+
default: true
54+
docs-version-override:
55+
description: Docs version if commit is not tagged
56+
required: false
57+
type: string
58+
default: ""
59+
notify-emails:
60+
description: Email addresses to send the notification to. Format as "me@me.com,you@you.com".
61+
required: false
62+
type: string
3763

3864
jobs:
3965
build-docs:
4066
uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_build_docs.yml@v0.67.0
67+
with:
68+
ref: ${{ inputs.build-docs-ref }}
4169

4270
publish-docs:
4371
runs-on: ubuntu-latest

.github/workflows/release.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@ on:
3030
required: true
3131
default: true
3232
type: boolean
33+
create-gh-release:
34+
description: Create a GitHub release
35+
required: true
36+
default: true
37+
type: boolean
38+
generate-changelog:
39+
description: Generate changelog
40+
required: false
41+
default: true
42+
type: boolean
43+
publish-docs:
44+
description: Publish docs
45+
required: false
46+
default: true
47+
type: boolean
3348
version-bump-branch:
3449
description: Branch for version bump
3550
required: true
@@ -47,6 +62,8 @@ jobs:
4762
dry-run: ${{ inputs.dry-run || false }}
4863
version-bump-branch: ${{ inputs.version-bump-branch || github.ref_name }}
4964
create-gh-release: ${{ inputs.create-gh-release || true }}
65+
gh-release-use-changelog-builder: ${{ inputs.generate-changelog }}
66+
publish-docs: ${{ inputs.publish-docs }}
5067
secrets:
5168
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
5269
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}

0 commit comments

Comments
 (0)