From 04315e7ad885dd9b8220ba7453b15f38ae565446 Mon Sep 17 00:00:00 2001 From: Kilian von Pflugk Date: Fri, 27 Sep 2024 21:25:49 +0200 Subject: [PATCH] ci: update bug report as well --- .github/workflows/release.yml | 2 +- validate-and-update-manifest.js | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5ddaf42..c2893b5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -59,6 +59,6 @@ jobs: run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" - git add README.md manifest.json ConfusedPolarBear.Plugin.IntroSkipper/ConfusedPolarBear.Plugin.IntroSkipper.csproj + git add README.md manifest.json ConfusedPolarBear.Plugin.IntroSkipper/ConfusedPolarBear.Plugin.IntroSkipper.csproj .github/ISSUE_TEMPLATE/bug_report_form.yml git commit -m "release v${{ env.NEW_FILE_VERSION }}" git push diff --git a/validate-and-update-manifest.js b/validate-and-update-manifest.js index 7a8f588..2c3840b 100644 --- a/validate-and-update-manifest.js +++ b/validate-and-update-manifest.js @@ -22,6 +22,13 @@ if (!fs.existsSync(readmePath)) { process.exit(1); } +// Read .github/ISSUE_TEMPLATE/bug_report_form.yml +const bugReportFormPath = './.github/ISSUE_TEMPLATE/bug_report_form.yml'; +if (!fs.existsSync(bugReportFormPath)) { + console.error(`${bugReportFormPath} file not found`); + process.exit(1); +} + const jsonData = JSON.parse(fs.readFileSync(manifestPath, 'utf8')); async function updateManifest() { @@ -41,7 +48,8 @@ async function updateManifest() { jsonData[0].versions.unshift(newVersion); console.log('Manifest updated successfully.'); - updateReadMeVersion(); + updateDocsVersion(readmePath); + updateDocsVersion(bugReportFormPath); cleanUpOldReleases(); @@ -109,16 +117,16 @@ function getMD5FromFile() { return crypto.createHash('md5').update(fileBuffer).digest('hex'); } -function updateReadMeVersion() { - const readMeContent = fs.readFileSync(readmePath, 'utf8'); +function updateDocsVersion(docsPath) { + const readMeContent = fs.readFileSync(docsPath, 'utf8'); const updatedContent = readMeContent .replace(/Jellyfin.*\(or newer\)/, `Jellyfin ${currentVersion} (or newer)`) if (readMeContent != updatedContent) { - fs.writeFileSync(readmePath, updatedContent); - console.log('Updated README with new Jellyfin version.'); + fs.writeFileSync(docsPath, updatedContent); + console.log(`Updated ${docsPath} with new Jellyfin version.`); } else { - console.log('README has already newest Jellyfin version.'); + console.log(`${docsPath} has already newest Jellyfin version.`); } }