Skip to content

Commit 2920769

Browse files
authored
ci: Fix pre-release version handling (#694)
1 parent 30a77fe commit 2920769

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

.github/scripts/before-beta-release.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@ const pkgJson = require(PKG_JSON_PATH);
1111
const PACKAGE_NAME = pkgJson.name;
1212
const VERSION = pkgJson.version;
1313

14-
const nextVersion = getNextVersion(VERSION);
14+
const nextVersion = addBetaSuffixToVersion(VERSION);
1515
console.log(`before-deploy: Setting version to ${nextVersion}`);
1616
pkgJson.version = nextVersion;
1717

1818
fs.writeFileSync(PKG_JSON_PATH, `${JSON.stringify(pkgJson, null, 2)}\n`);
1919

20-
function getNextVersion(version) {
20+
function addBetaSuffixToVersion(version) {
2121
const versionString = execSync(`npm show ${PACKAGE_NAME} versions --json`, { encoding: 'utf8' });
2222
const versions = JSON.parse(versionString);
2323

24-
if (versions.some((v) => v === VERSION)) {
24+
if (versions.some((v) => v === version)) {
2525
console.error(
26-
`before-deploy: A release with version ${VERSION} already exists. Please increment version accordingly.`,
26+
`before-deploy: A release with version ${version} already exists. Please increment version accordingly.`,
2727
);
2828
process.exit(1);
2929
}
3030

3131
const prereleaseNumbers = versions
32-
.filter((v) => v.startsWith(VERSION) && v.includes('-'))
32+
.filter((v) => v.startsWith(version) && v.includes('-'))
3333
.map((v) => Number(v.match(/\.(\d+)$/)[1]));
3434
const lastPrereleaseNumber = Math.max(-1, ...prereleaseNumbers);
3535
return `${version}-beta.${lastPrereleaseNumber + 1}`;

.github/workflows/pre_release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777

7878
publish_to_npm:
7979
name: Publish to NPM
80-
needs: [release_metadata, wait_for_checks]
80+
needs: [update_changelog, wait_for_checks]
8181
runs-on: ubuntu-latest
8282
steps:
8383
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)