Skip to content

Commit

Permalink
ci: add publish action (#29)
Browse files Browse the repository at this point in the history
* ci: add publish action

* format
  • Loading branch information
adjsky authored Oct 31, 2024
1 parent 7f9b6c8 commit d1ac3ae
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish

on:
release:
types: [published]
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 30

permissions:
contents: read
id-token: write

steps:
- name: Checkout repo
uses: actions/checkout@v3

- uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- uses: actions/setup-node@v3
with:
node-version: "20.x"

- name: Publish to JSR
run: deno publish

- name: Publish to NPM
run: deno run -A ./publish_npm.ts
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"test": "deno test --allow-read --allow-env --allow-sys"
},
"imports": {
"@david/dax": "jsr:@david/dax@^0.42.0",
"@deno/dnt": "jsr:@deno/dnt@^0.41.3",
"@std/assert": "jsr:@std/assert@^1.0.6",
"@std/testing": "jsr:@std/testing@^1.0.3"
Expand Down
7 changes: 7 additions & 0 deletions publish_npm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import denoJson from "./deno.json" with { type: "json" };
import { $ } from "@david/dax";

for (const cwd of denoJson.workspace) {
await $`cd ${cwd} && deno run -A ./build_npm.ts`;
await $`npm publish ${cwd}/npm`;
}

0 comments on commit d1ac3ae

Please sign in to comment.