Skip to content

Commit

Permalink
fix: download section
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-ippolito committed Apr 19, 2024
1 parent f65c680 commit 585007a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
3 changes: 1 addition & 2 deletions lib/github/templates/security-post-release.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
date: %ANNOUNCEMENT_DATE%
category: vulnerability
title: %RELEASE_DATE% Security Releases
title: %RELEASE_DATE% Security Releases
slug: %SLUG%
layout: blog-post
author: %AUTHOR%
Expand All @@ -13,7 +13,6 @@ Updates are now available for the %AFFECTED_VERSIONS% Node.js release lines for
following issues.
%DEPENDENCY_UPDATES%
%REPORTS%

## Downloads and release details

%DOWNLOADS%
9 changes: 2 additions & 7 deletions lib/security-release/security-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ import path from 'node:path';
export const NEXT_SECURITY_RELEASE_BRANCH = 'next-security-release';
export const NEXT_SECURITY_RELEASE_FOLDER = 'security-release/next-security-release';

// export const NEXT_SECURITY_RELEASE_REPOSITORY = {
// owner: 'nodejs-private',
// repo: 'security-release'
// };

export const NEXT_SECURITY_RELEASE_REPOSITORY = {
owner: 'marco-ippolito',
repo: 'test-repo-security-release'
owner: 'nodejs-private',
repo: 'security-release'
};

export const PLACEHOLDERS = {
Expand Down
16 changes: 13 additions & 3 deletions lib/security_blog.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'node:fs';
import path from 'node:path';
import _ from 'lodash';
import nv from '@pkgjs/nv';
import {
PLACEHOLDERS,
getVulnerabilitiesJSON,
Expand Down Expand Up @@ -197,7 +198,7 @@ export default class SecurityBlog {
.replaceAll(PLACEHOLDERS.reports, await this.getReportsTemplate(content))
.replaceAll(PLACEHOLDERS.dependencyUpdates,
this.getDependencyUpdatesTemplate(dependencyUpdates))
.replaceAll(PLACEHOLDERS.downloads, this.getDownloadsTemplate());
.replaceAll(PLACEHOLDERS.downloads, await this.getDownloadsTemplate(affectedVersions));
}

async getReportsTemplate(content) {
Expand Down Expand Up @@ -265,8 +266,17 @@ export default class SecurityBlog {
return template;
}

getDownloadsTemplate() {
return '';
async getDownloadsTemplate(affectedVersions) {
let template = '';
const versionsToBeReleased = (await nv('supported')).filter(
(v) => affectedVersions.split(', ').includes(`${v.major}.x`)
);
for (const version of versionsToBeReleased) {
const v = `v${version.major}.${version.minor}.${Number(version.patch) + 1}`;
template += `- [Node.js ${v}](/blog/release/${v}/)\n`;
}

return template;
}

getSlug(releaseDate) {
Expand Down

0 comments on commit 585007a

Please sign in to comment.