Skip to main content

Built and signed on GitHub Actions

Publishes a package to JSR with a version based on the current git tag.

This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
100%
Published
4 months ago (0.2.0)

@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.

Usage

Currently only works on GHA (PRs welcome for other CIs).

  1. Update your deno.json(c)/jsr.json(c) to not have a version field:

    {
      "name": "@scope/pkg",
      "exports": "./mod.ts"
    }
    
  2. 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.

  3. Ensure your workflow has sufficient permissions to publish (see JSR's publishing instructions):

    permissions:
      contents: read
      id-token: write
    
  4. On jsr.io, link your package to your GitHub repo in your package's publish settings.

  5. Draft a new release on GitHub and publish the release with a tag.

    • Alternatively, tag your repo with a version and push the changes.
      • ex. git tag 0.1.0 && git push 0.1.0
    • Note: The tag may have a leading v prefix.
    • This will kick off the workflow run that will publish with the tagged version.
Built and signed on
GitHub Actions
View transparency log

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@david/publish-on-tag

Import symbol

import * as publish_on_tag from "@david/publish-on-tag";
or

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
or (using pnpm 10.8 or older)
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
or (using Yarn 4.8 or older)
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";