From c539a8b10b8b222633c0ee83408eced239a26eac Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Wed, 4 Jan 2023 15:38:57 +0100 Subject: [PATCH] feat: publish changelog to gitea release --- .woodpecker/release-version.yml | 5 ++++- package.json | 1 + tools/changelog.mjs | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.woodpecker/release-version.yml b/.woodpecker/release-version.yml index 4796258..6cff093 100644 --- a/.woodpecker/release-version.yml +++ b/.woodpecker/release-version.yml @@ -14,11 +14,13 @@ pipeline: pull: true commands: - apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing helm - - apk add --no-cache git + - apk add --no-cache git npm - helm repo add bitnami https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami - helm dependency build - rm -rf tmp/ - helm package --version "${CI_COMMIT_TAG##v}" -d tmp/ ./ + - npm ci + - npm run changelog "${CI_COMMIT_TAG##v}" tmp/changelog.md secrets: - token @@ -32,6 +34,7 @@ pipeline: files: tmp/* title: ${CI_COMMIT_TAG##v} file_exists: fail + note: tmp/changelog.md publish-chart: image: alpine:3.17.0 diff --git a/package.json b/package.json index 034f8b6..60c1c58 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "npm": ">=8.0.0" }, "scripts": { + "changelog": "node tools/changelog.mjs", "readme:lint": "markdownlint *.md -f", "readme:parameters": "readme-generator -v values.yaml -r README.md" }, diff --git a/tools/changelog.mjs b/tools/changelog.mjs index 9d27233..68608da 100644 --- a/tools/changelog.mjs +++ b/tools/changelog.mjs @@ -1,15 +1,18 @@ import conventionalChangelogCore from 'conventional-changelog-core'; import conventionalChangelogPreset from 'conventional-changelog-conventionalcommits'; +import fs from "node:fs" const config = conventionalChangelogPreset(); +const file = process.argv[3] ? fs.createWriteStream(process.argv[3]): process.stdout; + conventionalChangelogCore( { config, releaseCount: 2, }, - { version: '0.1.1', linkCompare: false }, + { version: process.argv[2], linkCompare: false }, undefined, undefined, { headerPartial: '' } -).pipe(process.stdout); +).pipe(file);