Skip to content

Commit

Permalink
Add CHANGELOG.md to publish
Browse files Browse the repository at this point in the history
  • Loading branch information
mayank1513 committed Dec 30, 2023
1 parent 848bf8c commit dc13d66
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions lib/nextjs-themes/touchup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@ const path = require("node:path");

const packageJson = require(path.resolve(process.cwd(), "package.json"));
if (process.env.TOKEN) {
const { Octokit } = require("octokit");
// Octokit.js
// https://github.com/octokit/core.js#readme
const octokit = new Octokit({
auth: process.env.TOKEN,
});
const { Octokit } = require("octokit");
// Octokit.js
// https://github.com/octokit/core.js#readme
const octokit = new Octokit({
auth: process.env.TOKEN,
});

const octoOptions = {
owner: process.env.OWNER,
repo: process.env.REPO,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
};
const tagName = `v${packageJson.version}`;
const name = `Release ${tagName}`;
/** Create a release */
octokit.request("POST /repos/{owner}/{repo}/releases", {
...octoOptions,
tag_name: tagName,
target_commitish: "main",
name,
draft: false,
prerelease: false,
generate_release_notes: true,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
});
const octoOptions = {
owner: process.env.OWNER,
repo: process.env.REPO,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
};
const tagName = `v${packageJson.version}`;
const name = `Release ${tagName}`;
/** Create a release */
octokit.request("POST /repos/{owner}/{repo}/releases", {
...octoOptions,
tag_name: tagName,
target_commitish: "main",
name,
draft: false,
prerelease: false,
generate_release_notes: true,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
});
}
delete packageJson.scripts;

Expand All @@ -43,3 +43,5 @@ packageJson.types = "index.d.ts";
fs.writeFileSync(path.resolve(process.cwd(), "dist", "package.json"), JSON.stringify(packageJson, null, 2));

fs.copyFileSync(path.resolve(process.cwd(), "..", "..", "README.md"), path.resolve(process.cwd(), "dist", "README.md"));

fs.copyFileSync(path.resolve(__dirname, "CHANGELOG.md"), path.resolve(__dirname, "dist", "CHANGELOG.md"));

0 comments on commit dc13d66

Please sign in to comment.