mirror of
https://github.com/standardnotes/app
synced 2026-01-16 19:04:58 -05:00
chore(workflow): automated release notes
This commit is contained in:
8
.github/workflows/desktop.release.reuse.yml
vendored
8
.github/workflows/desktop.release.reuse.yml
vendored
@@ -172,14 +172,20 @@ jobs:
|
||||
uses: martinbeentjes/npm-get-version-action@main
|
||||
with:
|
||||
path: packages/desktop
|
||||
|
||||
- name: Generate Release Notes
|
||||
run: echo RELEASE_NOTES="$(node ../../scripts/changelog-parser.js web desktop)" >> $GITHUB_ENV
|
||||
continue-on-error: true
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
token: ${{ secrets.CI_PAT_TOKEN }}
|
||||
tag_name: "@standardnotes/desktop@${{ steps.package-version.outputs.current-version}}"
|
||||
name: "Desktop ${{ steps.package-version.outputs.current-version }}"
|
||||
body: ${{ env.RELEASE_NOTES }}
|
||||
prerelease: true
|
||||
draft: false
|
||||
name: "Desktop ${{ steps.package-version.outputs.current-version }}"
|
||||
files: packages/desktop/dist/*
|
||||
- name: Publish Snap
|
||||
continue-on-error: true
|
||||
|
||||
8
.github/workflows/mobile.release.prod.yml
vendored
8
.github/workflows/mobile.release.prod.yml
vendored
@@ -48,14 +48,20 @@ jobs:
|
||||
uses: martinbeentjes/npm-get-version-action@main
|
||||
with:
|
||||
path: packages/mobile
|
||||
|
||||
- name: Generate Release Notes
|
||||
run: echo RELEASE_NOTES="$(node ../../scripts/changelog-parser.js mobile)" >> $GITHUB_ENV
|
||||
continue-on-error: true
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
token: ${{ secrets.CI_PAT_TOKEN }}
|
||||
tag_name: "@standardnotes/mobile@${{ steps.package-version.outputs.current-version}}"
|
||||
name: "Mobile ${{ steps.package-version.outputs.current-version }}"
|
||||
body: ${{ env.RELEASE_NOTES }}
|
||||
prerelease: true
|
||||
draft: false
|
||||
name: "Mobile ${{ steps.package-version.outputs.current-version }}"
|
||||
files: |
|
||||
packages/mobile/android/app/build/outputs/bundle/prodRelease/app-prod-release.aab
|
||||
packages/mobile/android/app/build/outputs/apk/prod/release/app-prod-release.apk
|
||||
|
||||
BIN
.yarn/cache/changelog-parser-npm-2.8.1-d401bef657-3fc45cdd0c.zip
vendored
Normal file
BIN
.yarn/cache/changelog-parser-npm-2.8.1-d401bef657-3fc45cdd0c.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/line-reader-npm-0.2.4-c477dde8b9-a7426e5055.zip
vendored
Normal file
BIN
.yarn/cache/line-reader-npm-0.2.4-c477dde8b9-a7426e5055.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/remove-markdown-npm-0.2.2-eb8f462ff9-ce645115c0.zip
vendored
Normal file
BIN
.yarn/cache/remove-markdown-npm-0.2.2-eb8f462ff9-ce645115c0.zip
vendored
Normal file
Binary file not shown.
@@ -3,6 +3,10 @@
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"author": "Standard Notes.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/standardnotes/app"
|
||||
},
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
"packages/*",
|
||||
@@ -52,6 +56,7 @@
|
||||
"@standardnotes/config": "^2.4.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.20.0",
|
||||
"@typescript-eslint/parser": "^5.20.0",
|
||||
"changelog-parser": "^2.8.1",
|
||||
"css-loader": "^6.7.1",
|
||||
"eslint": "^8.17.0",
|
||||
"husky": "^8.0.0",
|
||||
|
||||
66
scripts/changelog-parser.js
Normal file
66
scripts/changelog-parser.js
Normal file
@@ -0,0 +1,66 @@
|
||||
const parseChangelog = require('changelog-parser')
|
||||
|
||||
const scopes = ['mobile', 'web', 'desktop', 'components']
|
||||
|
||||
async function parsePackages(packageNames) {
|
||||
let result = ''
|
||||
let index = 0
|
||||
for (const package of packageNames) {
|
||||
const parsed = await parseChangelog(`packages/${package}/CHANGELOG.md`)
|
||||
const latest = parsed.versions[0]
|
||||
if (packageNames.length > 1) {
|
||||
result += `## ${capitalizeFirstLetter(package)} Changes\n`
|
||||
}
|
||||
result += `${latest.body}\n`
|
||||
if (index !== packageNames.length - 1) {
|
||||
result += '\n'
|
||||
}
|
||||
index++
|
||||
}
|
||||
|
||||
return cleanOutputString(result)
|
||||
}
|
||||
|
||||
function capitalizeFirstLetter(string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1)
|
||||
}
|
||||
|
||||
function formatLine(line) {
|
||||
for (const scope of scopes) {
|
||||
const formattedScope = `**${scope}:**`
|
||||
if (line.includes(formattedScope)) {
|
||||
const parts = line.split(formattedScope)
|
||||
const hasBulletAndScope = parts.length === 2
|
||||
if (hasBulletAndScope) {
|
||||
return `${parts[0]}**${capitalizeFirstLetter(scope)}**: ${capitalizeFirstLetter(parts[1].trim())}`
|
||||
} else {
|
||||
return line.replace(formattedScope, `**${capitalizeFirstLetter(scope)}:**`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const bulletLinePrefix = '* '
|
||||
const bulletParts = line.split(bulletLinePrefix)
|
||||
const hasBulletOnly = bulletParts.length === 2
|
||||
if (hasBulletOnly) {
|
||||
return `${bulletLinePrefix} ${capitalizeFirstLetter(bulletParts[1])}`
|
||||
}
|
||||
|
||||
return line
|
||||
}
|
||||
|
||||
function cleanOutputString(string) {
|
||||
const lines = string.split('\n')
|
||||
const outLines = []
|
||||
for (const line of lines) {
|
||||
const outLine = formatLine(line)
|
||||
outLines.push(outLine)
|
||||
}
|
||||
|
||||
return outLines.join('\n')
|
||||
}
|
||||
|
||||
const packages = process.argv.slice(2);
|
||||
parsePackages(packages).then((result) => {
|
||||
process.stdout.write(result)
|
||||
})
|
||||
27
yarn.lock
27
yarn.lock
@@ -4962,6 +4962,7 @@ __metadata:
|
||||
"@standardnotes/snjs": ^2.117.8
|
||||
"@typescript-eslint/eslint-plugin": ^5.20.0
|
||||
"@typescript-eslint/parser": ^5.20.0
|
||||
changelog-parser: ^2.8.1
|
||||
css-loader: ^6.7.1
|
||||
eslint: ^8.17.0
|
||||
husky: ^8.0.0
|
||||
@@ -10945,6 +10946,18 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"changelog-parser@npm:^2.8.1":
|
||||
version: 2.8.1
|
||||
resolution: "changelog-parser@npm:2.8.1"
|
||||
dependencies:
|
||||
line-reader: ^0.2.4
|
||||
remove-markdown: ^0.2.2
|
||||
bin:
|
||||
changelog-parser: bin/cli.js
|
||||
checksum: 3fc45cdd0c89634a72f7632ef8e80b1ea43e09546c1ae64ecaf68f8e39cbc337d6012401fc3227ad28c2f6c959490ae83e11cb7ecf97358e29478eaea150747a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"char-regex@npm:^1.0.2":
|
||||
version: 1.0.2
|
||||
resolution: "char-regex@npm:1.0.2"
|
||||
@@ -21087,6 +21100,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"line-reader@npm:^0.2.4":
|
||||
version: 0.2.4
|
||||
resolution: "line-reader@npm:0.2.4"
|
||||
checksum: a7426e505526c0db83d4d240a3ee2d2ba7ccb5c7b461d8325b347c963393e3cfb8e67314f8d4c156e0a05e6e4dc49d27a8c61da380745293dd98b5d8123ae192
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lines-and-columns@npm:^1.1.6":
|
||||
version: 1.2.4
|
||||
resolution: "lines-and-columns@npm:1.2.4"
|
||||
@@ -28552,6 +28572,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"remove-markdown@npm:^0.2.2":
|
||||
version: 0.2.2
|
||||
resolution: "remove-markdown@npm:0.2.2"
|
||||
checksum: ce645115c0456a9b0132d1e6c3022e13a35e6efe8eff96b3da50f709b928379caf6a773e000a10158fb4b3dccd3262ec880c68fbe0a0d23dc30ec881672dbaa6
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"remove-trailing-separator@npm:^1.0.1":
|
||||
version: 1.1.0
|
||||
resolution: "remove-trailing-separator@npm:1.1.0"
|
||||
|
||||
Reference in New Issue
Block a user