@tarsilla/commit-wizard 1.4.6 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"crypto";import t from"fs";import{Octokit as a}from"@octokit/rest";import{analyzeCommits as r}from"@semantic-release/commit-analyzer";import{
|
|
1
|
+
import e from"crypto";import t from"fs";import{Octokit as a}from"@octokit/rest";import{analyzeCommits as r}from"@semantic-release/commit-analyzer";import{generateNotes as o}from"@semantic-release/release-notes-generator";const n={preset:"conventionalcommits",parserOpts:{headerPattern:RegExp("^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$"),headerCorrespondence:["type","exclamation1","scope","exclamation2","subject"]},releaseRules:[{type:"feat",exclamation1:"!",release:"major"},{type:"feat",exclamation2:"!",release:"major"},{type:"feat",release:"minor"},{type:"fix",release:"patch"},{type:"docs",release:"patch"},{type:"style",release:"patch"},{type:"refactor",release:"patch"},{type:"perf",release:"patch"},{type:"test",release:"patch"},{type:"build",release:"patch"},{type:"ci",release:"patch"},{type:"chore",release:"patch"},{type:"revert",release:"patch"}]};let s=!1;function i(e,t){const a=new URL(t).pathname,r=(a.startsWith("/")?a.slice(1):a).split("/").pop();return e.tap??`${r}.rb`}async function c(a,r){const{nextRelease:o,logger:n,options:s}=r;if(!o?.version)throw new Error("Next release version is not available.");const c=`v${o.version}`,l=s.repositoryUrl,p=new URL(l).pathname,h=`https://codeload.github.com/${p.startsWith("/")?p.slice(1):p}/tar.gz/refs/tags/${c}`,m=await async function(t,a){const{logger:r}=a;r.log(`Calculating SHA256 for URL: ${t}`);const o=await fetch(t);if(!o.ok)throw new Error(`Failed to fetch file. Status Code: ${o.status}`);if(!o.body)throw new Error("Response body is null.");const n=e.createHash("sha256"),s=o.body.getReader();return new Promise(((e,t)=>{!function a(){s.read().then((({done:t,value:r})=>{t?e(n.digest("hex")):(r&&n.update(r),a())})).catch(t)}()}))}(h,r),f=i(a,l);let u=t.readFileSync(f,"utf8");u=u.replace(/url ".*"/,`url "${h}"`),u=u.replace(/sha256 ".*"/,`sha256 "${m}"`),t.writeFileSync(f,u),n.log(`Updated formula with version ${c}, URL ${h}, and SHA256 ${m}`)}async function l(e,t){s=!0}const p={addChannel:async function(e,t){},verifyConditions:l,analyzeCommits:async function(e,t){return s||(await l(),s=!0),r(n,t)},generateNotes:async function(e,t){return s||(await l(),s=!0),o({},t)},prepare:async function(e,t){},publish:async function(e,r){return s||(await l(),s=!0),await c(e,r),await async function(e,r){if(!process.env.GITHUB_TOKEN)throw new Error("GITHUB_TOKEN is not set in the environment.");const{nextRelease:o,logger:n,options:s}=r,c=s.repositoryUrl,[l,p]=new URL(c).pathname.slice(1).split("/"),h=i(e,c),m=s.branch??"main";n.log(`Committing updated formula file ${h} to branch ${m}...`);const f=new a({auth:process.env.GITHUB_TOKEN});try{const{data:e}=await f.repos.getBranch({owner:l,repo:p,branch:m}),a=e.commit.sha,r=e.commit.commit.tree.sha;n.log(`Latest commit SHA: ${a}`),n.log(`Base tree SHA: ${r}`);const s=t.readFileSync(h,"utf8"),{data:i}=await f.git.createBlob({owner:l,repo:p,content:s,encoding:"utf-8"});n.log(`Created blob for ${h} with SHA: ${i.sha}`);const{data:c}=await f.git.createTree({owner:l,repo:p,base_tree:r,tree:[{path:h,mode:"100644",type:"blob",sha:i.sha}]});n.log(`Created new tree with SHA: ${c.sha}`);const u=`chore(release): ${o.version}`,{data:d}=await f.git.createCommit({owner:l,repo:p,message:u,tree:c.sha,parents:[a]});n.log(`Created new commit with SHA: ${d.sha}`),await f.git.updateRef({owner:l,repo:p,ref:`heads/${m}`,sha:d.sha}),n.log(`Branch ${m} updated to commit ${d.sha}`)}catch(e){throw n.error(`Failed to commit formula file: ${e.message}`),e}}(e,r),null},success:async function(e,t){},fail:async function(e,t){}};export{p as default};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/semantic-release/brew/index.ts"],"sourcesContent":["import crypto from 'crypto';\nimport fs from 'fs';\n\nimport { Octokit } from '@octokit/rest';\n//@ts-ignore\nimport { analyzeCommits as commitAnalyzerAnalyzeCommits } from '@semantic-release/commit-analyzer';\nimport {\n prepare as gitPrepare,\n verifyConditions as gitVerifyConditions,\n //@ts-ignore\n} from '@semantic-release/git';\n//@ts-ignore\nimport { generateNotes as notesGeneratorGenerateNotes } from '@semantic-release/release-notes-generator';\nimport {\n AddChannelContext,\n AnalyzeCommitsContext,\n FailContext,\n GenerateNotesContext,\n PrepareContext,\n PublishContext,\n SuccessContext,\n VerifyConditionsContext,\n} from 'semantic-release';\n\nimport { SemanticReleasePlugin } from '../types.js';\n\nconst analyzerConfig = {\n preset: 'conventionalcommits',\n parserOpts: {\n headerPattern: /^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$/,\n headerCorrespondence: ['type', 'exclamation1', 'scope', 'exclamation2', 'subject'],\n },\n releaseRules: [\n { type: 'feat', exclamation1: '!', release: 'major' },\n { type: 'feat', exclamation2: '!', release: 'major' },\n { type: 'feat', release: 'minor' },\n { type: 'fix', release: 'patch' },\n { type: 'docs', release: 'patch' },\n { type: 'style', release: 'patch' },\n { type: 'refactor', release: 'patch' },\n { type: 'perf', release: 'patch' },\n { type: 'test', release: 'patch' },\n { type: 'build', release: 'patch' },\n { type: 'ci', release: 'patch' },\n { type: 'chore', release: 'patch' },\n { type: 'revert', release: 'patch' },\n ],\n};\n\ntype PluginConfig = { tap?: string };\n\nlet verified = false;\n\nasync function createTag(_pluginConfig: PluginConfig, context: PrepareContext): Promise<void> {\n const { nextRelease, logger, options } = context;\n\n const tagName = `v${nextRelease.version}`;\n\n const repositoryUrl = options.repositoryUrl!; // Guaranteed to be defined by semantic-release\n const [owner, repo] = new URL(repositoryUrl).pathname.slice(1).split('/');\n\n logger.log(`Creating tag ${tagName} using GitHub API...`);\n\n const octokit = new Octokit({\n auth: process.env.GITHUB_TOKEN, // Ensure GITHUB_TOKEN is available in the environment\n });\n\n try {\n // Get the latest commit SHA from the default branch\n const { data: branch } = await octokit.repos.getBranch({\n owner,\n repo,\n branch: options.branch ?? 'main',\n });\n\n const commitSha = branch.commit.sha;\n\n // Create the tag object\n await octokit.git.createTag({\n owner,\n repo,\n tag: tagName,\n message: `Release ${tagName}`,\n object: commitSha,\n type: 'commit',\n });\n\n // Create the reference for the tag\n await octokit.git.createRef({\n owner,\n repo,\n ref: `refs/tags/${tagName}`,\n sha: commitSha,\n });\n\n logger.log(`Tag ${tagName} created successfully.`);\n } catch (error) {\n logger.error(`Failed to create tag ${tagName}: ${(error as Error).message}`);\n throw error;\n }\n}\n\nasync function calculateSha256(url: string, context: PrepareContext): Promise<string> {\n const { logger } = context;\n\n logger.log(`Calculating SHA256 for URL: ${url}`);\n\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch file. Status Code: ${response.status}`);\n }\n\n if (!response.body) {\n throw new Error('Response body is null.');\n }\n\n const hash = crypto.createHash('sha256');\n const reader = response.body.getReader();\n\n return new Promise((resolve, reject) => {\n function read() {\n reader\n .read()\n .then(({ done, value }) => {\n if (done) {\n resolve(hash.digest('hex'));\n return;\n }\n if (value) {\n hash.update(value);\n }\n read();\n })\n .catch(reject);\n }\n read();\n });\n}\n\nfunction getFormulaFile(pluginConfig: PluginConfig, repositoryUrl: string): string {\n const url = new URL(repositoryUrl);\n const repositoryPath = url.pathname;\n const repository = repositoryPath.startsWith('/') ? repositoryPath.slice(1) : repositoryPath;\n const project = repository.split('/').pop();\n\n return pluginConfig.tap ?? `${project}.rb`;\n}\n\nasync function updateFormulaFile(pluginConfig: PluginConfig, context: PrepareContext): Promise<void> {\n const { nextRelease, logger, options } = context;\n\n if (!nextRelease?.version) {\n throw new Error('Next release version is not available.');\n }\n\n const tagName = `v${nextRelease.version}`;\n\n const repositoryUrl = options.repositoryUrl!; // Guaranteed to be defined by semantic-release\n const url = new URL(repositoryUrl);\n const repositoryPath = url.pathname;\n const repository = repositoryPath.startsWith('/') ? repositoryPath.slice(1) : repositoryPath;\n\n const tarUrl = `https://codeload.github.com/${repository}/tar.gz/refs/tags/${tagName}`;\n const sha256 = await calculateSha256(tarUrl, context);\n const formulaFile = getFormulaFile(pluginConfig, repositoryUrl);\n\n let formulaContent = fs.readFileSync(formulaFile, 'utf8');\n formulaContent = formulaContent.replace(/url \".*\"/, `url \"${tarUrl}\"`);\n formulaContent = formulaContent.replace(/sha256 \".*\"/, `sha256 \"${sha256}\"`);\n fs.writeFileSync(formulaFile, formulaContent);\n\n logger.log(`Updated formula with version ${tagName}, URL ${tarUrl}, and SHA256 ${sha256}`);\n}\n\nasync function addChannel(_pluginConfig: PluginConfig, _context: AddChannelContext): Promise<void> {\n //do nothing\n}\n\nasync function analyzeCommits(pluginConfig: PluginConfig, context: AnalyzeCommitsContext): Promise<string | false> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n return commitAnalyzerAnalyzeCommits(analyzerConfig, context);\n}\n\nasync function fail(_pluginConfig: PluginConfig, _context: FailContext): Promise<void> {\n //do nothing\n}\n\nasync function generateNotes(pluginConfig: PluginConfig, context: GenerateNotesContext): Promise<string> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n return notesGeneratorGenerateNotes({}, context);\n}\n\nasync function prepare(pluginConfig: PluginConfig, context: PrepareContext): Promise<void> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n if (gitPrepare) {\n const { options } = context;\n const repositoryUrl = options.repositoryUrl!; // Guaranteed to be defined by semantic-release\n const formulaFile = getFormulaFile(pluginConfig, repositoryUrl);\n\n await createTag(pluginConfig, context);\n\n await updateFormulaFile(pluginConfig, context);\n\n await gitPrepare(\n {\n assets: [formulaFile],\n message: 'chore(release): ${nextRelease.version}',\n },\n context,\n );\n }\n}\n\nasync function publish(_pluginConfig: PluginConfig, _context: PublishContext): Promise<unknown> {\n //do nothing\n return null;\n}\n\nasync function success(_pluginConfig: PluginConfig, _context: SuccessContext): Promise<void> {\n //do nothing\n}\n\nasync function verifyConditions(pluginConfig: PluginConfig, context: VerifyConditionsContext): Promise<void> {\n if (gitVerifyConditions) {\n const { options } = context;\n const repositoryUrl = options.repositoryUrl!; // Guaranteed to be defined by semantic-release\n const formulaFile = getFormulaFile(pluginConfig, repositoryUrl);\n await gitVerifyConditions(\n {\n assets: [formulaFile],\n message: 'chore(release): ${nextRelease.version}',\n },\n context,\n );\n }\n verified = true;\n}\n\nconst plugin: SemanticReleasePlugin<{ tap: string }> = {\n addChannel,\n verifyConditions,\n analyzeCommits,\n generateNotes,\n prepare,\n publish,\n success,\n fail,\n};\n\nexport default plugin;\n"],"names":["analyzerConfig","preset","parserOpts","headerPattern","RegExp","headerCorrespondence","releaseRules","type","exclamation1","release","exclamation2","verified","getFormulaFile","pluginConfig","repositoryUrl","repositoryPath","URL","pathname","project","startsWith","slice","split","pop","tap","async","updateFormulaFile","context","nextRelease","logger","options","version","Error","tagName","tarUrl","sha256","url","log","response","fetch","ok","status","body","hash","crypto","createHash","reader","getReader","Promise","resolve","reject","read","then","done","value","digest","update","catch","calculateSha256","formulaFile","formulaContent","fs","readFileSync","replace","writeFileSync","verifyConditions","gitVerifyConditions","assets","message","plugin","addChannel","_pluginConfig","_context","analyzeCommits","commitAnalyzerAnalyzeCommits","generateNotes","notesGeneratorGenerateNotes","prepare","gitPrepare","owner","repo","octokit","Octokit","auth","process","env","GITHUB_TOKEN","data","branch","repos","getBranch","commitSha","commit","sha","git","createTag","tag","object","createRef","ref","error","publish","success","fail"],"mappings":"mSA0BA,MAAMA,EAAiB,CACrBC,OAAQ,sBACRC,WAAY,CACVC,cAAeC,OAAA,mGACfC,qBAAsB,CAAC,OAAQ,eAAgB,QAAS,eAAgB,YAE1EC,aAAc,CACZ,CAAE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C,YAAEA,EAAWC,OAAEA,EAAMC,QAAEA,GAAYH,EAEnCM,EAAU,IAAIL,EAAYG,UAE1BhB,EAAgBe,EAAQf,eACvBgE,EAAOC,GAAQ,IAAI/D,IAAIF,GAAeG,SAASG,MAAM,GAAGC,MAAM,KAErEO,EAAOQ,IAAI,gBAAgBJ,yBAE3B,MAAMgD,EAAU,IAAIC,EAAQ,CAC1BC,KAAMC,QAAQC,IAAIC,eAGpB,IAEE,MAAQC,KAAMC,SAAiBP,EAAQQ,MAAMC,UAAU,CACrDX,QACAC,OACAQ,OAAQ1D,EAAQ0D,QAAU,SAGtBG,EAAYH,EAAOI,OAAOC,UAG1BZ,EAAQa,IAAIC,UAAU,CAC1BhB,QACAC,OACAgB,IAAK/D,EACLmC,QAAS,WAAWnC,IACpBgE,OAAQN,EACRnF,KAAM,iBAIFyE,EAAQa,IAAII,UAAU,CAC1BnB,QACAC,OACAmB,IAAK,aAAalE,IAClB4D,IAAKF,IAGP9D,EAAOQ,IAAI,OAAOJ,0BACpB,CAAE,MAAOmE,GAEP,MADAvE,EAAOuE,MAAM,wBAAwBnE,MAAamE,EAAgBhC,WAC5DgC,CACR,CACF,CAgHUL,CAAUjF,EAAca,SAExBD,EAAkBZ,EAAca,SAEhCmD,EACJ,CACEX,OAAQ,CAACR,GACTS,QAAS,0CAEXzC,EAEJ,CACF,EAiCE0E,QA/BF5E,eAAuB8C,EAA6BC,GAElD,OAAO,IACT,EA6BE8B,QA3BF7E,eAAuB8C,EAA6BC,GAEpD,EA0BE+B,KAvEF9E,eAAoB8C,EAA6BC,GAEjD"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/semantic-release/brew/index.ts"],"sourcesContent":["import crypto from 'crypto';\nimport fs from 'fs';\n\nimport { Octokit } from '@octokit/rest';\n//@ts-ignore\nimport { analyzeCommits as commitAnalyzerAnalyzeCommits } from '@semantic-release/commit-analyzer';\n//@ts-ignore\nimport { generateNotes as notesGeneratorGenerateNotes } from '@semantic-release/release-notes-generator';\nimport {\n AddChannelContext,\n AnalyzeCommitsContext,\n FailContext,\n GenerateNotesContext,\n PrepareContext,\n PublishContext,\n SuccessContext,\n VerifyConditionsContext,\n} from 'semantic-release';\n\nimport { SemanticReleasePlugin } from '../types.js';\n\nconst analyzerConfig = {\n preset: 'conventionalcommits',\n parserOpts: {\n headerPattern: /^(?<type>\\w+)(?<exclamation1>!?)(?:\\((?<scope>[^)]+)\\)(?<exclamation2>!?))?: (?<subject>.+)$/,\n headerCorrespondence: ['type', 'exclamation1', 'scope', 'exclamation2', 'subject'],\n },\n releaseRules: [\n { type: 'feat', exclamation1: '!', release: 'major' },\n { type: 'feat', exclamation2: '!', release: 'major' },\n { type: 'feat', release: 'minor' },\n { type: 'fix', release: 'patch' },\n { type: 'docs', release: 'patch' },\n { type: 'style', release: 'patch' },\n { type: 'refactor', release: 'patch' },\n { type: 'perf', release: 'patch' },\n { type: 'test', release: 'patch' },\n { type: 'build', release: 'patch' },\n { type: 'ci', release: 'patch' },\n { type: 'chore', release: 'patch' },\n { type: 'revert', release: 'patch' },\n ],\n};\n\ntype PluginConfig = { tap?: string };\n\nlet verified = false;\n\nfunction getFormulaFile(pluginConfig: PluginConfig, repositoryUrl: string): string {\n const url = new URL(repositoryUrl);\n const repositoryPath = url.pathname;\n const repository = repositoryPath.startsWith('/') ? repositoryPath.slice(1) : repositoryPath;\n const project = repository.split('/').pop();\n\n return pluginConfig.tap ?? `${project}.rb`;\n}\n\nasync function commitFormulaFile(pluginConfig: PluginConfig, context: PrepareContext): Promise<void> {\n if (!process.env.GITHUB_TOKEN) {\n throw new Error('GITHUB_TOKEN is not set in the environment.');\n }\n\n const { nextRelease, logger, options } = context;\n\n const repositoryUrl = options.repositoryUrl!; // Guaranteed to be defined by semantic-release\n const [owner, repo] = new URL(repositoryUrl).pathname.slice(1).split('/');\n\n const formulaFile = getFormulaFile(pluginConfig, repositoryUrl);\n const branchName = options.branch ?? 'main';\n\n logger.log(`Committing updated formula file ${formulaFile} to branch ${branchName}...`);\n\n const octokit = new Octokit({\n auth: process.env.GITHUB_TOKEN,\n });\n\n try {\n // Get the latest commit SHA and tree SHA from the branch\n const { data: branch } = await octokit.repos.getBranch({\n owner,\n repo,\n branch: branchName,\n });\n\n const latestCommitSha = branch.commit.sha;\n const baseTreeSha = branch.commit.commit.tree.sha;\n\n logger.log(`Latest commit SHA: ${latestCommitSha}`);\n logger.log(`Base tree SHA: ${baseTreeSha}`);\n\n // Read the updated formula file content\n const formulaContent = fs.readFileSync(formulaFile, 'utf8');\n\n // Create a new blob for the updated formula file\n const { data: blob } = await octokit.git.createBlob({\n owner,\n repo,\n content: formulaContent,\n encoding: 'utf-8',\n });\n\n logger.log(`Created blob for ${formulaFile} with SHA: ${blob.sha}`);\n\n // Create a new tree with the updated formula file\n const { data: newTree } = await octokit.git.createTree({\n owner,\n repo,\n base_tree: baseTreeSha,\n tree: [\n {\n path: formulaFile,\n mode: '100644',\n type: 'blob',\n sha: blob.sha,\n },\n ],\n });\n\n logger.log(`Created new tree with SHA: ${newTree.sha}`);\n\n // Create a new commit with the updated tree\n const commitMessage = `chore(release): ${nextRelease.version}`;\n const { data: newCommit } = await octokit.git.createCommit({\n owner,\n repo,\n message: commitMessage,\n tree: newTree.sha,\n parents: [latestCommitSha],\n });\n\n logger.log(`Created new commit with SHA: ${newCommit.sha}`);\n\n // Update the branch reference to point to the new commit\n await octokit.git.updateRef({\n owner,\n repo,\n ref: `heads/${branchName}`,\n sha: newCommit.sha,\n });\n\n logger.log(`Branch ${branchName} updated to commit ${newCommit.sha}`);\n } catch (error) {\n logger.error(`Failed to commit formula file: ${(error as Error).message}`);\n throw error;\n }\n}\n\nasync function calculateSha256(url: string, context: PrepareContext): Promise<string> {\n const { logger } = context;\n\n logger.log(`Calculating SHA256 for URL: ${url}`);\n\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch file. Status Code: ${response.status}`);\n }\n\n if (!response.body) {\n throw new Error('Response body is null.');\n }\n\n const hash = crypto.createHash('sha256');\n const reader = response.body.getReader();\n\n return new Promise((resolve, reject) => {\n function read() {\n reader\n .read()\n .then(({ done, value }) => {\n if (done) {\n resolve(hash.digest('hex'));\n return;\n }\n if (value) {\n hash.update(value);\n }\n read();\n })\n .catch(reject);\n }\n read();\n });\n}\n\nasync function updateFormulaFile(pluginConfig: PluginConfig, context: PrepareContext): Promise<void> {\n const { nextRelease, logger, options } = context;\n\n if (!nextRelease?.version) {\n throw new Error('Next release version is not available.');\n }\n\n const tagName = `v${nextRelease.version}`;\n\n const repositoryUrl = options.repositoryUrl!; // Guaranteed to be defined by semantic-release\n const url = new URL(repositoryUrl);\n const repositoryPath = url.pathname;\n const repository = repositoryPath.startsWith('/') ? repositoryPath.slice(1) : repositoryPath;\n\n const tarUrl = `https://codeload.github.com/${repository}/tar.gz/refs/tags/${tagName}`;\n const sha256 = await calculateSha256(tarUrl, context);\n const formulaFile = getFormulaFile(pluginConfig, repositoryUrl);\n\n let formulaContent = fs.readFileSync(formulaFile, 'utf8');\n formulaContent = formulaContent.replace(/url \".*\"/, `url \"${tarUrl}\"`);\n formulaContent = formulaContent.replace(/sha256 \".*\"/, `sha256 \"${sha256}\"`);\n fs.writeFileSync(formulaFile, formulaContent);\n\n logger.log(`Updated formula with version ${tagName}, URL ${tarUrl}, and SHA256 ${sha256}`);\n}\n\nasync function addChannel(_pluginConfig: PluginConfig, _context: AddChannelContext): Promise<void> {\n //do nothing\n}\n\nasync function analyzeCommits(pluginConfig: PluginConfig, context: AnalyzeCommitsContext): Promise<string | false> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n return commitAnalyzerAnalyzeCommits(analyzerConfig, context);\n}\n\nasync function fail(_pluginConfig: PluginConfig, _context: FailContext): Promise<void> {\n //do nothing\n}\n\nasync function generateNotes(pluginConfig: PluginConfig, context: GenerateNotesContext): Promise<string> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n return notesGeneratorGenerateNotes({}, context);\n}\n\nasync function prepare(_pluginConfig: PluginConfig, _context: PrepareContext): Promise<void> {\n //do nothing\n}\n\nasync function publish(pluginConfig: PluginConfig, context: PublishContext): Promise<unknown> {\n if (!verified) {\n await verifyConditions(pluginConfig, context);\n verified = true;\n }\n\n await updateFormulaFile(pluginConfig, context);\n\n await commitFormulaFile(pluginConfig, context);\n\n return null;\n}\n\nasync function success(_pluginConfig: PluginConfig, _context: SuccessContext): Promise<void> {\n //do nothing\n}\n\nasync function verifyConditions(_pluginConfig: PluginConfig, _context: VerifyConditionsContext): Promise<void> {\n verified = true;\n}\n\nconst plugin: SemanticReleasePlugin<{ tap: string }> = {\n addChannel,\n verifyConditions,\n analyzeCommits,\n generateNotes,\n prepare,\n publish,\n success,\n fail,\n};\n\nexport default plugin;\n"],"names":["analyzerConfig","preset","parserOpts","headerPattern","RegExp","headerCorrespondence","releaseRules","type","exclamation1","release","exclamation2","verified","getFormulaFile","pluginConfig","repositoryUrl","repositoryPath","URL","pathname","project","startsWith","slice","split","pop","tap","async","updateFormulaFile","context","nextRelease","logger","options","version","Error","tagName","tarUrl","sha256","url","log","response","fetch","ok","status","body","hash","crypto","createHash","reader","getReader","Promise","resolve","reject","read","then","done","value","digest","update","catch","calculateSha256","formulaFile","formulaContent","fs","readFileSync","replace","writeFileSync","verifyConditions","_pluginConfig","_context","plugin","addChannel","analyzeCommits","commitAnalyzerAnalyzeCommits","generateNotes","notesGeneratorGenerateNotes","prepare","publish","process","env","GITHUB_TOKEN","owner","repo","branchName","branch","octokit","Octokit","auth","data","repos","getBranch","latestCommitSha","commit","sha","baseTreeSha","tree","blob","git","createBlob","content","encoding","newTree","createTree","base_tree","path","mode","commitMessage","newCommit","createCommit","message","parents","updateRef","ref","error","commitFormulaFile","success","fail"],"mappings":"6NAqBA,MAAMA,EAAiB,CACrBC,OAAQ,sBACRC,WAAY,CACVC,cAAeC,OAAA,mGACfC,qBAAsB,CAAC,OAAQ,eAAgB,QAAS,eAAgB,YAE1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,GAE/B,IACT,EAiBEsF,QAfFxF,eAAuByC,EAA6BC,GAEpD,EAcE+C,KA9CFzF,eAAoByC,EAA6BC,GAEjD"}
|
package/package.json
CHANGED
|
@@ -4,11 +4,6 @@ import fs from 'fs';
|
|
|
4
4
|
import { Octokit } from '@octokit/rest';
|
|
5
5
|
//@ts-ignore
|
|
6
6
|
import { analyzeCommits as commitAnalyzerAnalyzeCommits } from '@semantic-release/commit-analyzer';
|
|
7
|
-
import {
|
|
8
|
-
prepare as gitPrepare,
|
|
9
|
-
verifyConditions as gitVerifyConditions,
|
|
10
|
-
//@ts-ignore
|
|
11
|
-
} from '@semantic-release/git';
|
|
12
7
|
//@ts-ignore
|
|
13
8
|
import { generateNotes as notesGeneratorGenerateNotes } from '@semantic-release/release-notes-generator';
|
|
14
9
|
import {
|
|
@@ -51,51 +46,101 @@ type PluginConfig = { tap?: string };
|
|
|
51
46
|
|
|
52
47
|
let verified = false;
|
|
53
48
|
|
|
54
|
-
|
|
55
|
-
const
|
|
49
|
+
function getFormulaFile(pluginConfig: PluginConfig, repositoryUrl: string): string {
|
|
50
|
+
const url = new URL(repositoryUrl);
|
|
51
|
+
const repositoryPath = url.pathname;
|
|
52
|
+
const repository = repositoryPath.startsWith('/') ? repositoryPath.slice(1) : repositoryPath;
|
|
53
|
+
const project = repository.split('/').pop();
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
return pluginConfig.tap ?? `${project}.rb`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function commitFormulaFile(pluginConfig: PluginConfig, context: PrepareContext): Promise<void> {
|
|
59
|
+
if (!process.env.GITHUB_TOKEN) {
|
|
60
|
+
throw new Error('GITHUB_TOKEN is not set in the environment.');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const { nextRelease, logger, options } = context;
|
|
58
64
|
|
|
59
65
|
const repositoryUrl = options.repositoryUrl!; // Guaranteed to be defined by semantic-release
|
|
60
66
|
const [owner, repo] = new URL(repositoryUrl).pathname.slice(1).split('/');
|
|
61
67
|
|
|
62
|
-
|
|
68
|
+
const formulaFile = getFormulaFile(pluginConfig, repositoryUrl);
|
|
69
|
+
const branchName = options.branch ?? 'main';
|
|
70
|
+
|
|
71
|
+
logger.log(`Committing updated formula file ${formulaFile} to branch ${branchName}...`);
|
|
63
72
|
|
|
64
73
|
const octokit = new Octokit({
|
|
65
|
-
auth: process.env.GITHUB_TOKEN,
|
|
74
|
+
auth: process.env.GITHUB_TOKEN,
|
|
66
75
|
});
|
|
67
76
|
|
|
68
77
|
try {
|
|
69
|
-
// Get the latest commit SHA from the
|
|
78
|
+
// Get the latest commit SHA and tree SHA from the branch
|
|
70
79
|
const { data: branch } = await octokit.repos.getBranch({
|
|
71
80
|
owner,
|
|
72
81
|
repo,
|
|
73
|
-
branch:
|
|
82
|
+
branch: branchName,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const latestCommitSha = branch.commit.sha;
|
|
86
|
+
const baseTreeSha = branch.commit.commit.tree.sha;
|
|
87
|
+
|
|
88
|
+
logger.log(`Latest commit SHA: ${latestCommitSha}`);
|
|
89
|
+
logger.log(`Base tree SHA: ${baseTreeSha}`);
|
|
90
|
+
|
|
91
|
+
// Read the updated formula file content
|
|
92
|
+
const formulaContent = fs.readFileSync(formulaFile, 'utf8');
|
|
93
|
+
|
|
94
|
+
// Create a new blob for the updated formula file
|
|
95
|
+
const { data: blob } = await octokit.git.createBlob({
|
|
96
|
+
owner,
|
|
97
|
+
repo,
|
|
98
|
+
content: formulaContent,
|
|
99
|
+
encoding: 'utf-8',
|
|
74
100
|
});
|
|
75
101
|
|
|
76
|
-
|
|
102
|
+
logger.log(`Created blob for ${formulaFile} with SHA: ${blob.sha}`);
|
|
77
103
|
|
|
78
|
-
// Create the
|
|
79
|
-
await octokit.git.
|
|
104
|
+
// Create a new tree with the updated formula file
|
|
105
|
+
const { data: newTree } = await octokit.git.createTree({
|
|
80
106
|
owner,
|
|
81
107
|
repo,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
108
|
+
base_tree: baseTreeSha,
|
|
109
|
+
tree: [
|
|
110
|
+
{
|
|
111
|
+
path: formulaFile,
|
|
112
|
+
mode: '100644',
|
|
113
|
+
type: 'blob',
|
|
114
|
+
sha: blob.sha,
|
|
115
|
+
},
|
|
116
|
+
],
|
|
86
117
|
});
|
|
87
118
|
|
|
88
|
-
|
|
89
|
-
|
|
119
|
+
logger.log(`Created new tree with SHA: ${newTree.sha}`);
|
|
120
|
+
|
|
121
|
+
// Create a new commit with the updated tree
|
|
122
|
+
const commitMessage = `chore(release): ${nextRelease.version}`;
|
|
123
|
+
const { data: newCommit } = await octokit.git.createCommit({
|
|
90
124
|
owner,
|
|
91
125
|
repo,
|
|
92
|
-
|
|
93
|
-
|
|
126
|
+
message: commitMessage,
|
|
127
|
+
tree: newTree.sha,
|
|
128
|
+
parents: [latestCommitSha],
|
|
94
129
|
});
|
|
95
130
|
|
|
96
|
-
logger.log(`
|
|
131
|
+
logger.log(`Created new commit with SHA: ${newCommit.sha}`);
|
|
132
|
+
|
|
133
|
+
// Update the branch reference to point to the new commit
|
|
134
|
+
await octokit.git.updateRef({
|
|
135
|
+
owner,
|
|
136
|
+
repo,
|
|
137
|
+
ref: `heads/${branchName}`,
|
|
138
|
+
sha: newCommit.sha,
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
logger.log(`Branch ${branchName} updated to commit ${newCommit.sha}`);
|
|
97
142
|
} catch (error) {
|
|
98
|
-
logger.error(`Failed to
|
|
143
|
+
logger.error(`Failed to commit formula file: ${(error as Error).message}`);
|
|
99
144
|
throw error;
|
|
100
145
|
}
|
|
101
146
|
}
|
|
@@ -138,15 +183,6 @@ async function calculateSha256(url: string, context: PrepareContext): Promise<st
|
|
|
138
183
|
});
|
|
139
184
|
}
|
|
140
185
|
|
|
141
|
-
function getFormulaFile(pluginConfig: PluginConfig, repositoryUrl: string): string {
|
|
142
|
-
const url = new URL(repositoryUrl);
|
|
143
|
-
const repositoryPath = url.pathname;
|
|
144
|
-
const repository = repositoryPath.startsWith('/') ? repositoryPath.slice(1) : repositoryPath;
|
|
145
|
-
const project = repository.split('/').pop();
|
|
146
|
-
|
|
147
|
-
return pluginConfig.tap ?? `${project}.rb`;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
186
|
async function updateFormulaFile(pluginConfig: PluginConfig, context: PrepareContext): Promise<void> {
|
|
151
187
|
const { nextRelease, logger, options } = context;
|
|
152
188
|
|
|
@@ -199,33 +235,20 @@ async function generateNotes(pluginConfig: PluginConfig, context: GenerateNotesC
|
|
|
199
235
|
return notesGeneratorGenerateNotes({}, context);
|
|
200
236
|
}
|
|
201
237
|
|
|
202
|
-
async function prepare(
|
|
238
|
+
async function prepare(_pluginConfig: PluginConfig, _context: PrepareContext): Promise<void> {
|
|
239
|
+
//do nothing
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
async function publish(pluginConfig: PluginConfig, context: PublishContext): Promise<unknown> {
|
|
203
243
|
if (!verified) {
|
|
204
244
|
await verifyConditions(pluginConfig, context);
|
|
205
245
|
verified = true;
|
|
206
246
|
}
|
|
207
247
|
|
|
208
|
-
|
|
209
|
-
const { options } = context;
|
|
210
|
-
const repositoryUrl = options.repositoryUrl!; // Guaranteed to be defined by semantic-release
|
|
211
|
-
const formulaFile = getFormulaFile(pluginConfig, repositoryUrl);
|
|
212
|
-
|
|
213
|
-
await createTag(pluginConfig, context);
|
|
248
|
+
await updateFormulaFile(pluginConfig, context);
|
|
214
249
|
|
|
215
|
-
|
|
250
|
+
await commitFormulaFile(pluginConfig, context);
|
|
216
251
|
|
|
217
|
-
await gitPrepare(
|
|
218
|
-
{
|
|
219
|
-
assets: [formulaFile],
|
|
220
|
-
message: 'chore(release): ${nextRelease.version}',
|
|
221
|
-
},
|
|
222
|
-
context,
|
|
223
|
-
);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
async function publish(_pluginConfig: PluginConfig, _context: PublishContext): Promise<unknown> {
|
|
228
|
-
//do nothing
|
|
229
252
|
return null;
|
|
230
253
|
}
|
|
231
254
|
|
|
@@ -233,19 +256,7 @@ async function success(_pluginConfig: PluginConfig, _context: SuccessContext): P
|
|
|
233
256
|
//do nothing
|
|
234
257
|
}
|
|
235
258
|
|
|
236
|
-
async function verifyConditions(
|
|
237
|
-
if (gitVerifyConditions) {
|
|
238
|
-
const { options } = context;
|
|
239
|
-
const repositoryUrl = options.repositoryUrl!; // Guaranteed to be defined by semantic-release
|
|
240
|
-
const formulaFile = getFormulaFile(pluginConfig, repositoryUrl);
|
|
241
|
-
await gitVerifyConditions(
|
|
242
|
-
{
|
|
243
|
-
assets: [formulaFile],
|
|
244
|
-
message: 'chore(release): ${nextRelease.version}',
|
|
245
|
-
},
|
|
246
|
-
context,
|
|
247
|
-
);
|
|
248
|
-
}
|
|
259
|
+
async function verifyConditions(_pluginConfig: PluginConfig, _context: VerifyConditionsContext): Promise<void> {
|
|
249
260
|
verified = true;
|
|
250
261
|
}
|
|
251
262
|
|