Skip to content

Commit

Permalink
Merge pull request #935 from lukso-network/chore/npm-publish-tag
Browse files Browse the repository at this point in the history
ci: modify publish script to not publish release-candidates as latest on npm
  • Loading branch information
CJ42 authored Mar 25, 2024
2 parents 5ee6211 + 7f28878 commit a6b47b1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions publish.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
#!/usr/bin/env node
import { readFile } from 'fs/promises';
import { $ } from 'zx';
import { readFile } from "fs/promises";
import { $ } from "zx";

const outputs = JSON.parse(await readFile(process.argv[2], 'utf-8'));
const outputs = JSON.parse(await readFile(process.argv[2], "utf-8"));
for (const key in outputs) {
const value = outputs[key];
const match = key.match(/^(.*\/.*)--release_created$/);

// Skip if no release was created for this LSP package
if (!match || !value) continue;

const version = key.match(/^(.*\/.*)--version$/);

// Do not publish as latest on npm if we are doing a release candidate
const tag = version.includes("-rc") ? "rc" : "latest";

const workspace = match[1];
await $`npm publish --workspace=./${workspace} --no-git-checks --access public`;
await $`npm publish --workspace=./${workspace} --tag ${tag} --no-git-checks --access public`;
}

0 comments on commit a6b47b1

Please sign in to comment.