Skip to content

Commit

Permalink
Consolidated Release Notes (#170)
Browse files Browse the repository at this point in the history
* Add workflow for release notes generation

Signed-off-by: Derek Nola <[email protected]>

* Initial landing of release notes

Signed-off-by: Derek Nola <[email protected]>
  • Loading branch information
dereknola authored Sep 1, 2023
1 parent 991d006 commit e3fffe5
Show file tree
Hide file tree
Showing 8 changed files with 1,540 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/release-notes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Collect all
on:
workflow_dispatch

permissions:
contents: write
pull-requests: write
jobs:
collect-all:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Generate release notes
run: |
rm docs/release-notes/*.md
scripts/collect-all-release-notes.sh
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: update release-notes/k3s-*.md
title: Update Release Notes
body: Automated release notes update
branch: update-release-notes
1 change: 1 addition & 0 deletions .remarkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs/release-notes/*
494 changes: 494 additions & 0 deletions docs/release-notes/v1.24.X.md

Large diffs are not rendered by default.

429 changes: 429 additions & 0 deletions docs/release-notes/v1.25.X.md

Large diffs are not rendered by default.

336 changes: 336 additions & 0 deletions docs/release-notes/v1.26.X.md

Large diffs are not rendered by default.

194 changes: 194 additions & 0 deletions docs/release-notes/v1.27.X.md

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions scripts/collect-all-release-notes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
function gen_md_link()
{
release_link=$(echo $1 | tr '[:upper:]' '[:lower:]' | sed -e 's/ /-/g' -e 's/\.//g' -e 's/+//g')
echo "${release_link}"
}

MINORS="v1.24 v1.25 v1.26 v1.27"

for minor in $MINORS; do
product=k3s
k3s_table=$(mktemp)
previous=""
file=docs/release-notes/${minor}.X.md
for patch in $(gh release list -R "k3s-io/${product}" --exclude-drafts --exclude-pre-releases --limit=1000 | awk -F '\t' '{ print $3 }' | grep ^"${minor}"); do
publish_date=$(gh release view "${patch}" -R "k3s-io/${product}" --json publishedAt -q '.publishedAt' | awk -F'T' '{ print $1 }')
echo "# Release ${patch}" >> "${file}"
gh release view "${patch}" -R "k3s-io/${product}" --json body -q '.body' >> "${file}"
echo "-----" >> "${file}"
body=$(gh release view "${patch}" -R "k3s-io/${product}" --json body -q '.body')
# Extract from each release notes the component table, building a single table with all the components
if [ -z "${previous}" ]; then
title="---\nhide_table_of_contents: true\n---\n\n# ${minor}.X\n"
echo -e "${title}" >> $k3s_table
upgrade_link="[Urgent Upgrade Notes](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-${minor:1}.md#urgent-upgrade-notes)"
upgrade_warning=":::caution Upgrade Notice\nBefore upgrading from earlier releases, be sure to read the Kubernetes ${upgrade_link}.\n:::\n"
echo -e "${upgrade_warning}" >> $k3s_table
echo -n "| Version | Release date " >> $k3s_table
echo "$body" | grep "^|" | tail -n+3 | awk -F'|' '{ print $2 }' | while read column; do echo -n "| $column " >> $k3s_table; done
echo " |" >> $k3s_table
echo -n "| ----- | ----- " >> $k3s_table
echo "$body" | grep "^|" | tail -n+3 | awk -F'|' '{ print $2 }' | while read column; do echo -n "| ----- " >> $k3s_table; done
echo " |" >> $k3s_table
fi
echo -n "| [${patch}](${minor}.X.md#release-$(gen_md_link $patch)) | $(date +"%b %d %Y" -d "${publish_date}")" >> $k3s_table
echo "$body" | grep "^|" | tail -n+3 | awk -F'|' '{ print $3 }' | while read column; do echo -n "| $column " >> $k3s_table; done
echo " |" >> $k3s_table
previous=$patch
# Remove the component table from each individual release notes
perl -i -p0e 's/^## Embedded Component Versions.*?^-----/-----/gms' "${file}"
# Add extra levels for Docusaurus Sidebar
sed -i 's/^# Release/## Release/' "${file}"
sed -i 's/^## Changes since/### Changes since/' "${file}"
done
echo -e "\n<br />\n" >> $k3s_table
# Append the global component and version table
k3stmp=$(mktemp)
cat $k3s_table "${file}" > $k3stmp && mv $k3stmp "${file}"
echo "Collected release notes for ${product} ${minor}"
done
10 changes: 10 additions & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ module.exports = {
'reference/resource-profiling',
],
},
{
type: 'category',
label: 'Release Notes',
items: [
{
type: 'autogenerated',
dirName: 'release-notes',
},
],
},
{
type: 'autogenerated',
dirName: 'known-issues',
Expand Down

0 comments on commit e3fffe5

Please sign in to comment.