Skip to content

Commit 955aff0

Browse files
authored
cp: Update release workflow to include changelog and publish docs (NVIDIA#3472) (NVIDIA#3480)
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
1 parent 1290d52 commit 955aff0

File tree

5 files changed

+132
-369
lines changed

5 files changed

+132
-369
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: true
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_PASSWORD:
4358
required: true
@@ -338,12 +353,51 @@ jobs:
338353
ref: ${{ inputs.release-ref }}
339354
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
340355

356+
- name: Determine fromTag for changelog
357+
id: determine-from-tag
358+
if: inputs.gh-release-use-changelog-builder == true
359+
run: |
360+
cd ${{ github.run_id }}
361+
362+
# If gh-release-from-tag is provided, use it
363+
if [[ -n "${{ inputs.gh-release-from-tag }}" ]]; then
364+
FROM_TAG="${{ inputs.gh-release-from-tag }}"
365+
echo "Using provided fromTag: $FROM_TAG"
366+
else
367+
# Get the most recent tag
368+
FROM_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
369+
if [[ -z "$FROM_TAG" ]]; then
370+
echo "No previous tags found, leaving fromTag empty"
371+
else
372+
echo "Auto-detected most recent tag: $FROM_TAG"
373+
fi
374+
fi
375+
376+
echo "from-tag=$FROM_TAG" >> $GITHUB_OUTPUT
377+
378+
- name: Build Changelog
379+
id: build-changelog
380+
if: inputs.gh-release-use-changelog-builder == true
381+
uses: mikepenz/release-changelog-builder-action@v6.1.0
382+
env:
383+
GITHUB_TOKEN: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
384+
with:
385+
configuration: ${{ github.run_id }}/${{ inputs.gh-release-changelog-config }}
386+
owner: ${{ github.repository_owner }}
387+
repo: ${{ github.event.repository.name }}
388+
ignorePreReleases: "false"
389+
failOnError: "false"
390+
fromTag: ${{ steps.determine-from-tag.outputs.from-tag }}
391+
toTag: ${{ inputs.release-ref }}
392+
mode: ${{ inputs.gh-release-changelog-mode }}
393+
341394
- name: Create release
342395
id: version-number
343396
env:
344397
SHA: ${{ inputs.release-ref }}
345398
GH_TOKEN: ${{ secrets.PAT }}
346399
IS_DRY_RUN: ${{ inputs.dry-run }}
400+
BUILT_CHANGELOG: ${{ steps.build-changelog.outputs.changelog }}
347401
run: |
348402
cd ${{ github.run_id }}
349403
@@ -352,7 +406,10 @@ jobs:
352406
IS_PRERELEASE=$([[ "$IS_RELEASE_CANDIDATE" == "true" || "$IS_ALPHA" == "true" ]] && echo "true" || echo "false")
353407
NAME="NVIDIA $PROJECT_NAME ${VERSION}"
354408
355-
if [[ "$IS_RELEASE_CANDIDATE" == "true" ]]; then
409+
# Use built changelog if available, otherwise fall back to CHANGELOG.md
410+
if [[ -n "$BUILT_CHANGELOG" ]]; then
411+
CHANGELOG="$BUILT_CHANGELOG"
412+
elif [[ "$IS_RELEASE_CANDIDATE" == "true" ]]; then
356413
DATE=$(date +"%Y-%m-%d")
357414
CHANGELOG="Prerelease: $NAME ($DATE)"
358415
else
@@ -395,6 +452,16 @@ jobs:
395452
eval "$CMD"
396453
fi
397454
455+
publish-docs:
456+
needs: [bump-next-version, create-gh-release]
457+
uses: ./.github/workflows/release-docs.yml
458+
with:
459+
dry-run: ${{ inputs.dry-run }}
460+
publish-as-latest: true
461+
docs-version-override: ${{ needs.bump-next-version.outputs.release-version }}
462+
build-docs-ref: ${{ inputs.release-ref }}
463+
secrets: inherit
464+
398465
notify:
399466
needs: [build-test-publish-wheels, create-gh-release]
400467
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+
workflow_call:
38+
inputs:
39+
dry-run:
40+
description: Whether to run the workflow in dry-run mode
41+
required: true
42+
type: boolean
43+
default: true
44+
publish-as-latest:
45+
description: Publish as Latest stable version.
46+
required: false
47+
type: boolean
48+
default: true
49+
docs-version-override:
50+
description: Docs version if commit is not tagged
51+
required: false
52+
type: string
53+
default: ""
54+
notify-emails:
55+
description: Email addresses to send the notification to. Format as "me@me.com,you@you.com".
56+
required: false
57+
type: string
58+
build-docs-ref:
59+
description: Reference to build the docs from
60+
required: false
61+
type: string
62+
default: ${{ github.sha }}
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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ on:
3030
required: true
3131
default: true
3232
type: boolean
33+
generate-changelog:
34+
description: Generate changelog
35+
required: false
36+
default: true
37+
type: boolean
38+
publish-docs:
39+
description: Publish docs
40+
required: false
41+
default: true
42+
type: boolean
3343
version-bump-branch:
3444
description: Branch for version bump
3545
required: true
@@ -47,6 +57,8 @@ jobs:
4757
dry-run: ${{ inputs.dry-run || false }}
4858
version-bump-branch: ${{ inputs.version-bump-branch || github.ref_name }}
4959
create-gh-release: ${{ inputs.create-gh-release || true }}
60+
gh-release-use-changelog-builder: ${{ inputs.generate-changelog }}
61+
publish-docs: ${{ inputs.publish-docs }}
5062
secrets:
5163
TWINE_PASSWORD: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/r')) && secrets.SVC_PYPI_TOKEN || secrets.SVC_PYPI_TEST_TOKEN }}
5264
SLACK_WEBHOOK: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/r')) && secrets.SLACK_MAIN_CHANNEL_WEBHOOK || secrets.SLACK_CI_CHANNEL_WEBHOOK }}

0 commit comments

Comments
 (0)