Skip to content

Commit 0a0ed3d

Browse files
authored
changelog workflow (#315)
1 parent 0a25fd6 commit 0a0ed3d

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: 'Changelog Build (Release)'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
last-release-tag:
7+
description: Last Git tag to start from (exclusive) (e.g. `v2.0.0`)
8+
type: string
9+
required: true
10+
release-branch:
11+
description: Release branch to build changelog on (e.g. `r2.1.0`)
12+
type: string
13+
required: true
14+
15+
jobs:
16+
changelog:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout branch
20+
uses: actions/checkout@v4
21+
with:
22+
ref: main
23+
fetch-depth: 0
24+
25+
- name: Build Changelog
26+
id: github_tag
27+
uses: mikepenz/[email protected]
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
with:
31+
# Configuration file is setup with filters for domains
32+
# owner:repo must point to current repo
33+
# fromTag: Auto resolved from historical tag order (previous tag compared to current tag)
34+
# toTag: Current tag reference
35+
configuration: ".github/workflows/config/changelog-config.json"
36+
owner: "NVIDIA"
37+
repo: "NeMo"
38+
ignorePreReleases: "false"
39+
failOnError: "false"
40+
fromTag: ${{ inputs.last-release-tag }}
41+
toTag: ${{ inputs.release-branch }}
42+
43+
- name: Update changelog file
44+
env:
45+
RELEASE_BRANCH: ${{ inputs.release-branch }}
46+
CHANGELOG: ${{ steps.github_tag.outputs.changelog }}
47+
shell: bash -x -e -u -o pipefail {0}
48+
run: |
49+
RELEASE_VERSION=${RELEASE_BRANCH#r}
50+
CHANGELOG=$(echo "$CHANGELOG" | sed '/^[[:blank:]]*#/s/#/###/')
51+
52+
RELEASE_NOTES="## NVIDIA Neural Modules $RELEASE_VERSION
53+
54+
### Detailed Changelogs:
55+
56+
$CHANGELOG"
57+
58+
printf "%s\n" "$RELEASE_NOTES" | sed '/<!-- Next changelog -->/r /dev/stdin' CHANGELOG.md > CHANGELOG.tmp.md
59+
60+
mv CHANGELOG.tmp.md CHANGELOG.md
61+
62+
- name: Inspect new changelog file
63+
run: cat CHANGELOG.md
64+
65+
- name: Create Pull Request
66+
uses: peter-evans/create-pull-request@v7
67+
with:
68+
commit-message: "beep boop: Update changelog"
69+
title: "Update changelog for `${{ inputs.release-branch }}`"
70+
signoff: true
71+
sign-commits: true
72+
base: main
73+
branch: bot/chore/update-changelog-into-${{ inputs.release-branch }}

0 commit comments

Comments
 (0)