build: fix changelog generation
This commit is contained in:
parent
00df9b574c
commit
9eae9d2a6e
4 changed files with 18 additions and 12 deletions
|
@ -29,6 +29,8 @@ jobs:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
with:
|
with:
|
||||||
show-progress: false
|
show-progress: false
|
||||||
|
fetch-depth: 0 # Important for changelog
|
||||||
|
filter: blob:none # We don't need all blobs
|
||||||
|
|
||||||
- uses: ./.forgejo/actions/setup
|
- uses: ./.forgejo/actions/setup
|
||||||
- uses: ./.forgejo/actions/setup-node
|
- uses: ./.forgejo/actions/setup-node
|
||||||
|
@ -38,6 +40,10 @@ jobs:
|
||||||
- run: make readme
|
- run: make readme
|
||||||
- run: git diff --exit-code --name-only README.md
|
- run: git diff --exit-code --name-only README.md
|
||||||
|
|
||||||
|
- name: changelog
|
||||||
|
run: |
|
||||||
|
pnpm changelog ${{ github.ref_type == 'tag' && 'true' || '' }}
|
||||||
|
|
||||||
lint-helm:
|
lint-helm:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
steps:
|
steps:
|
||||||
|
@ -170,9 +176,6 @@ jobs:
|
||||||
fetch-depth: 0 # Important for changelog
|
fetch-depth: 0 # Important for changelog
|
||||||
filter: blob:none # We don't need all blobs
|
filter: blob:none # We don't need all blobs
|
||||||
|
|
||||||
# required for proper changelogs
|
|
||||||
- run: git checkout -b "release/${GITHUB_REF_NAME#v}"
|
|
||||||
|
|
||||||
- uses: ./.forgejo/actions/setup
|
- uses: ./.forgejo/actions/setup
|
||||||
- uses: ./.forgejo/actions/setup-node
|
- uses: ./.forgejo/actions/setup-node
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
import { getChangelog } from './changelog/util.js';
|
import { getChangelog } from './changelog/util.js';
|
||||||
import fs from 'node:fs';
|
|
||||||
|
|
||||||
const file = process.argv[3]
|
const stream = getChangelog(!!process.argv[2]).setEncoding('utf8');
|
||||||
? fs.createWriteStream(process.argv[3])
|
|
||||||
: process.stdout;
|
|
||||||
|
|
||||||
getChangelog(process.argv[2], !!process.argv[2]).pipe(file);
|
const changes = (await stream.toArray()).join('');
|
||||||
|
|
||||||
|
if (!changes.length) {
|
||||||
|
console.error('No changelog found');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
process.stdout.write(changes);
|
||||||
|
|
|
@ -56,17 +56,16 @@ export const config = conventionalChangelogPreset({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string|undefined} version
|
|
||||||
* @param {boolean|undefined} onTag
|
* @param {boolean|undefined} onTag
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getChangelog(version = undefined, onTag = false) {
|
export function getChangelog(onTag = false) {
|
||||||
return conventionalChangelogCore(
|
return conventionalChangelogCore(
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
releaseCount: onTag ? 2 : 1,
|
releaseCount: onTag ? 2 : 1,
|
||||||
},
|
},
|
||||||
{ version, linkCompare: false },
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
{ headerPartial: '' },
|
{ headerPartial: '' },
|
||||||
|
|
|
@ -68,7 +68,7 @@ class GiteaReleaseCommand extends Command {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const stream = getChangelog(tag, true).setEncoding('utf8');
|
const stream = getChangelog(true).setEncoding('utf8');
|
||||||
const changes = (await stream.toArray()).join('');
|
const changes = (await stream.toArray()).join('');
|
||||||
|
|
||||||
this.context.stdout.write(`Creating release ${tag}.\n`);
|
this.context.stdout.write(`Creating release ${tag}.\n`);
|
||||||
|
|
Loading…
Reference in a new issue