Skip to content

Commit

Permalink
Merge pull request #18 from subquery/fix-release-pipeline
Browse files Browse the repository at this point in the history
[SKIPCI] fix release pipeline
  • Loading branch information
jiqiang90 authored Feb 3, 2025
2 parents ffa37e5 + 70c64c2 commit 58e434f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions .github/actions/create-release/gh-release-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const myArgs = process.argv.slice(2);
const pJson = require(`${myArgs[0]}/package.json`)

const version = pJson.version;
const repoName = pJson.name;
const repoName = pJson.name;

const packageName = repoName.split('/');

Expand All @@ -21,7 +21,7 @@ function checkForBetaVersion(version) {
function gatherReleaseInfo(logPath) {
const changeLogs = fs.readFileSync(logPath, 'utf8');
const regex = /## \[([0-9]+(\.[0-9]+)+)] - [0-9]{4}-[0-9]{2}-[0-9]{2}/i;

let lines = changeLogs.split(/\n/);
let foundChangelog = false;
let releaseInfo = '';
Expand All @@ -32,7 +32,7 @@ function gatherReleaseInfo(logPath) {
i = j;
j = lines.length;
foundChangelog = true;
}
}
}

lines = lines.slice(i);
Expand All @@ -42,21 +42,21 @@ function gatherReleaseInfo(logPath) {
if(j == 0){
releaseInfo += `${lines[j]}`+ '\n';
continue;
}
}

if(!regex.test(lines[j])){
releaseInfo += `${lines[j]}`+ '\n';
} else {
j = lines.length;
}
}
}

if(releaseInfo === ''){
core.setFailed("No release info found, either missing in changelog or changelog is formatted incorrectly")
}

console.log("Gathered release info...")
console.log("Gathered release info...")
return releaseInfo;
}

Expand All @@ -68,17 +68,17 @@ async function publishRelease(releaseInfo) {
},
owner: 'subquery',
name: `[${version}] ${repoName}`,
repo: 'subql-ethereum',
repo: 'subql-starknet',
tag_name: `${packageName[1]}/${version}`,
target_commitish: `${myArgs[1]}`,
body: releaseInfo
}).catch( err => {
core.setFailed(err)
})

console.log("Release Created...")
console.log("Release Created...")
}

checkForBetaVersion(version);

const releaseInfo = gatherReleaseInfo(`${myArgs[0]}/CHANGELOG.md`);
Expand Down

0 comments on commit 58e434f

Please sign in to comment.