Skip to content

Commit

Permalink
add dry run
Browse files Browse the repository at this point in the history
  • Loading branch information
thdxr committed Oct 12, 2024
1 parent a6ea0f7 commit 71f0193
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/binary.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: generate

on:
workflow_dispatch:
pull_request:
push:
workflow_dispatch:
branches:
- master

Expand All @@ -27,4 +28,9 @@ jobs:
npm whoami
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: bun run generate.ts
- run: |
if [ "${{ github.ref }}" = "refs/heads/master" ]; then
bun run generate.ts
else
bun run generate.ts --dry
fi
4 changes: 3 additions & 1 deletion generate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { $ } from "bun";

const dry = process.argv.includes("--dry");

for (const file of new Bun.Glob("*").scanSync("metadata")) {
const provider = await import(`./metadata/${file}`);
const version = [provider.version, provider.suffix].filter(Boolean).join("-");
Expand Down Expand Up @@ -37,5 +39,5 @@ for (const file of new Bun.Glob("*").scanSync("metadata")) {
await Bun.write(tsconfig, JSON.stringify(tsjson, null, 2));

await $`bun install && bun run build`;
await $`npm publish --access public`;
if (!dry) await $`npm publish --access public`;
}

0 comments on commit 71f0193

Please sign in to comment.