@david/publish-on-tag
Publishes a package to JSR with a version based on the current git tag or otherwise runs a dry publish.
This enables you to not have to store a version number in git and instead rely on tags for publishing. The usage is a single line to add to your GHA workflow file.
Currently only works on GHA (PRs welcome for other CIs).
Update your deno.json(c)/jsr.json(c) to not have a version field:
{ "name": "@scope/pkg", "exports": "./mod.ts" }
Update your GHA to run this package instead of deno publish
:
- name: Publish on tag # replace x.x.x with pinned version of this package run: deno run -A jsr:@david/publish-on-tag@x.x.x # or forward additional arguments to `deno publish` # run: deno run -A jsr:@david/publish-on-tag@x.x.x --allow-slow-types
For an example, see the ci.yml file in this repository.
Ensure your workflow has sufficient permissions to publish (see JSR's publishing instructions):
permissions: contents: read id-token: write
On jsr.io, link your package to your GitHub repo in your package's publish settings.
Draft a new release on GitHub and publish the release with a tag.
git tag 0.1.0 && git push 0.1.0
v
prefix.Add Package
deno add jsr:@david/publish-on-tag
Import symbol
import * as publish_on_tag from "@david/publish-on-tag";
Import directly with a jsr specifier
import * as publish_on_tag from "jsr:@david/publish-on-tag";
Add Package
pnpm i jsr:@david/publish-on-tag
pnpm dlx jsr add @david/publish-on-tag
Import symbol
import * as publish_on_tag from "@david/publish-on-tag";
Add Package
yarn add jsr:@david/publish-on-tag
yarn dlx jsr add @david/publish-on-tag
Import symbol
import * as publish_on_tag from "@david/publish-on-tag";
Add Package
npx jsr add @david/publish-on-tag
Import symbol
import * as publish_on_tag from "@david/publish-on-tag";
Add Package
bunx jsr add @david/publish-on-tag
Import symbol
import * as publish_on_tag from "@david/publish-on-tag";