Skip to content

Commit

Permalink
theme: restructure release notes #917
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed Oct 11, 2024
1 parent c3763a9 commit 5356b3b
Show file tree
Hide file tree
Showing 57 changed files with 1,040 additions and 693 deletions.
32 changes: 20 additions & 12 deletions .github/actions/check_milestone/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ runs:
with:
path: layouts/partials/version.txt

- name: Get old major version number
id: oldmajorvers
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.oldvers.outputs.contents }}
regex: (\d+)\.\d+\.\d+.*
replacement: '$1'

- name: Get old main version number
id: oldmainvers
uses: ashley-taylor/regex-property-action@v1
Expand All @@ -66,18 +74,18 @@ runs:
regex: \d+\.\d+\.(\d+)
replacement: "$1"

- name: Get migration notes
id: migrationnotes
- name: Get releasenotes
id: releasenotes
uses: andstor/file-reader-action@v1
with:
path: exampleSite/content/basics/migration/_index.en.md
path: exampleSite/content/basics/releasenotes/${{ steps.oldmajorvers.outputs.value }}.x/_index.en.md

- name: Check for old migration notes
- name: Check for old releasenotes
id: hasoldnotes
uses: ashley-taylor/regex-property-action@v1
with:
value: ${{ steps.migrationnotes.outputs.contents }}
regex: '.*?[\n\r\s]*<!--GH-ACTION-RELEASE-MILESTONE-->[\n\r\s]*-*\s*[\n\r\s]*?[\n\r]+##\s+${{ steps.oldmainvers.outputs.value }}\.0\s+.*?[\n\r][\n\r\s]*.*'
value: ${{ steps.releasenotes.outputs.contents }}
regex: '.*?[\n\r\s]*<!--GH-ACTION-RELEASE-MILESTONE-->[\n\r\s]*[\n\r]+##\s+${{ steps.oldmainvers.outputs.value }}\.0\s+.*?[\n\r][\n\r\s]*.*'
flags: gs
replacement: '1'

Expand All @@ -94,12 +102,12 @@ runs:
- name: Log results and exit
shell: bash
run: |
echo outcome : ${{ steps.outcome.outputs.outcome }}
echo has closed issues : ${{ fromJSON(steps.closed_issues.outputs.data).search.issueCount > 0 }}
echo has open issues : ${{ fromJSON(steps.open_issues.outputs.data).search.issueCount > 0 }}
echo is patch version : ${{ steps.patchvers.outputs.value != '0' }}
echo has old main notes : ${{ steps.hasoldnotes.outputs.value == '1' }}
echo are notes okay : ${{ (steps.patchvers.outputs.value!='0'&&steps.hasoldnotes.outputs.value=='1') || (steps.patchvers.outputs.value=='0'&&steps.hasoldnotes.outputs.value!='1') }}
echo outcome : ${{ steps.outcome.outputs.outcome }}
echo has closed issues : ${{ fromJSON(steps.closed_issues.outputs.data).search.issueCount > 0 }}
echo has open issues : ${{ fromJSON(steps.open_issues.outputs.data).search.issueCount > 0 }}
echo is patch version : ${{ steps.patchvers.outputs.value != '0' }}
echo has old releasenotes : ${{ steps.hasoldnotes.outputs.value == '1' }}
echo are notes okay : ${{ (steps.patchvers.outputs.value!='0'&&steps.hasoldnotes.outputs.value=='1') || (steps.patchvers.outputs.value=='0'&&steps.hasoldnotes.outputs.value!='1') }}
if [ "${{ steps.outcome.outputs.outcome }}" = "failure" ]; then
exit 1
fi
28 changes: 14 additions & 14 deletions .github/actions/release_milestone/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,35 @@ runs:
with:
format: 'YYYY-MM-DD'

- name: Get current main version number
id: mainvers
- name: Get current major version number
id: majorvers
uses: ashley-taylor/regex-property-action@v1
env:
MILESTONE: ${{ inputs.milestone }}
with:
value: ${{ env.MILESTONE }}
regex: (\d+\.\d+)\.\d+
regex: (\d+)\.\d+\.\d+
replacement: "$1"

- name: Get current main version number for anchoring
id: mainanchor
- name: Get current main version number
id: mainvers
uses: ashley-taylor/regex-property-action@v1
env:
MILESTONE: ${{ inputs.milestone }}
with:
value: ${{ env.MILESTONE }}
regex: (\d+)\.(\d+)\.\d+
replacement: "$1$2"
replacement: "$1.$2"

- name: Get current major version number
id: majorvers
- name: Get current main version number for anchoring
id: mainanchor
uses: ashley-taylor/regex-property-action@v1
env:
MILESTONE: ${{ inputs.milestone }}
with:
value: ${{ env.MILESTONE }}
regex: (\d+)\.\d+\.\d+
replacement: "$1"
regex: (\d+)\.(\d+)\.\d+
replacement: "$1$2"

- name: Get next version number
id: nextvers
Expand Down Expand Up @@ -87,12 +87,12 @@ runs:
git tag --force --message "" "$MILESTONE"
git push --force origin "$MILESTONE"
- name: Update migration docs
- name: Update releasenotes
uses: mingjun97/file-regex-replace@v1
with:
regex: '(.)[\n\r\s]*<!--GH-ACTION-RELEASE-MILESTONE-->[\n\r\s]*-*\s*[\n\r\s]*?[\n\r]+##\s*.*?[\n\r][\n\r\s]*(.)'
replacement: "$1\n\n<!--GH-ACTION-RELEASE-MILESTONE-->\n\n---\n\n## ${{ steps.mainvers.outputs.value }}.0 (${{ steps.date.outputs.time }}) {#${{ steps.mainanchor.outputs.value }}0}\n\n$2"
include: exampleSite/content/basics/migration/_index.en.md
regex: '(.)[\n\r\s]*<!--GH-ACTION-RELEASE-MILESTONE-->[\n\r\s]*[\n\r]+##\s*.*?[\n\r][\n\r\s]*(.)'
replacement: "$1\n\n<!--GH-ACTION-RELEASE-MILESTONE-->\n\n## ${{ steps.mainvers.outputs.value }}.0 (${{ steps.date.outputs.time }}) {#${{ steps.mainanchor.outputs.value }}0}\n\n$2"
include: exampleSite/content/basics/releasenotes/${{ steps.majorvers.outputs.value }}.x/_index.en.md

- name: Update generator version
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .grenrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ module.exports = {
onlyMilestones: true,
template: {
group: "\n### {{heading}}\n",
release: ({ body, date, release }) => `## ${release} (` + date.replace( /(\d+)\/(\d+)\/(\d+)/, '$3-$2-$1' ) + `)\n\n[What's new in this release](https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#` + release.replace( /(\d+)\.(\d+)\.(\d+)/, '$1$2' ) + `0)\n${body}`,
release: ({ body, date, release }) => `## ${release} (` + date.replace( /(\d+)\/(\d+)\/(\d+)/, '$3-$2-$1' ) + `)\n\n[What's new in this release](https://mcshelby.github.io/hugo-theme-relearn/basics/releasenotes/` + release.replace( /(\d+)\.(\d+)\.(\d+)/, '$1' ) + `.x/#` + release.replace( /(\d+)\.(\d+)\.(\d+)/, '$1$2' ) + `0)\n${body}`,
},
};
Loading

0 comments on commit 5356b3b

Please sign in to comment.