From d6b0e61c99b90b47c1eaf663bbd0a064ac380a98 Mon Sep 17 00:00:00 2001 From: Alisue Date: Mon, 13 May 2024 00:34:59 +0900 Subject: [PATCH] Publish to JSR --- .github/workflows/jsr.yml | 27 +++++++++++++++++++++++++++ .github/workflows/test.yml | 11 +++++++++++ README.md | 7 +++---- deno.jsonc | 21 ++++++++++++++++++++- mod.ts | 4 ++-- 5 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/jsr.yml diff --git a/.github/workflows/jsr.yml b/.github/workflows/jsr.yml new file mode 100644 index 0000000..2de3f3a --- /dev/null +++ b/.github/workflows/jsr.yml @@ -0,0 +1,27 @@ +name: jsr + +env: + DENO_VERSION: 1.x + +on: + push: + tags: + - "v*" + +permissions: + contents: read + id-token: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: denoland/setup-deno@v1 + with: + deno-version: ${{ env.DENO_VERSION }} + - name: Publish + run: | + deno run -A jsr:@david/publish-on-tag@0.1.3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2175223..abc9d19 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -63,3 +63,14 @@ jobs: - name: Benchmark run: | deno task bench | aha --no-header >> $GITHUB_STEP_SUMMARY + + jsr-publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: denoland/setup-deno@v1 + with: + deno-version: ${{ env.DENO_VERSION }} + - name: Publish (dry-run) + run: | + deno publish --dry-run diff --git a/README.md b/README.md index a382595..5b03a23 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # workerio -[![deno land](http://img.shields.io/badge/available%20on-deno.land/x-lightgrey.svg?logo=deno)](https://deno.land/x/workerio) -[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/workerio/mod.ts) +[![JSR](https://jsr.io/badges/@lambdalisue/workerio)](https://jsr.io/@lambdalisue/workerio) [![Test](https://github.com/lambdalisue/deno-workerio/actions/workflows/test.yml/badge.svg)](https://github.com/lambdalisue/deno-workerio/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/lambdalisue/deno-workerio/graph/badge.svg?token=6Q1iOBg2Ka)](https://codecov.io/gh/lambdalisue/deno-workerio) @@ -21,7 +20,7 @@ import { readableStreamFromWorker, writableStreamFromWorker, -} from "https://deno.land/x/workerio@$MODULE_VERSION/mod.ts"; +} from "@lambdalisue/workerio"; const decoder = new TextDecoder(); const encoder = new TextEncoder(); @@ -50,7 +49,7 @@ for await (const data of reader) { import { readableStreamFromWorker, writableStreamFromWorker, -} from "https://deno.land/x/workerio@$MODULE_VERSION/mod.ts"; +} from "@lambdalisue/workerio"; const decoder = new TextDecoder(); const encoder = new TextEncoder(); diff --git a/deno.jsonc b/deno.jsonc index 01834cb..d922387 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,4 +1,23 @@ { + "name": "@lambdalisue/workerio", + "version": "0.0.0", + "exports": { + ".": "./mod.ts", + "./readable_stream": "./readable_stream.ts", + "./writable_stream": "./writable_stream.ts" + }, + "publish": { + "include": ["LICENSE", "README.md", "**/*.ts"], + "exclude": [ + "./readable_stream_bench.ts", + "./readable_stream_test.ts", + "./test_bench.ts", + "./test_echo_server.ts", + "./test_util.ts", + "./writable_stream_bench.ts", + "./writable_stream_test.ts" + ] + }, "tasks": { "check": "deno check **/*.ts", "test": "deno test -A --doc --parallel --shuffle", @@ -11,6 +30,6 @@ "imports": { "@std/assert": "jsr:@std/assert@^0.225.1", "@std/bytes": "jsr:@std/bytes@^0.224.0", - "https://deno.land/x/workerio@$MODULE_VERSION/": "./" + "@lambdalisue/workerio": "./mod.ts" } } diff --git a/mod.ts b/mod.ts index ab22378..20c6f43 100644 --- a/mod.ts +++ b/mod.ts @@ -15,7 +15,7 @@ * import { * readableStreamFromWorker, * writableStreamFromWorker, - * } from "https://deno.land/x/workerio@$MODULE_VERSION/mod.ts"; + * } from "@lambdalisue/workerio"; * * const decoder = new TextDecoder(); * const encoder = new TextEncoder(); @@ -44,7 +44,7 @@ * import { * readableStreamFromWorker, * writableStreamFromWorker, - * } from "https://deno.land/x/workerio@$MODULE_VERSION/mod.ts"; + * } from "@lambdalisue/workerio"; * * const decoder = new TextDecoder(); * const encoder = new TextEncoder();