ci: 💚 Make CI be able to choose between JSR or NPM publish

This commit is contained in:
Jesse Wierzbinski 2024-06-07 23:02:50 -10:00
parent 16fe6118bf
commit a87de7d20b
No known key found for this signature in database

View file

@ -22,6 +22,14 @@ on:
- client - client
type: choice type: choice
required: true required: true
registry:
description: "Registry to publish to"
required: true
type: choice
options:
- npm
- jsr
default: "npm"
permissions: permissions:
contents: read contents: read
@ -52,9 +60,11 @@ jobs:
run: 'sed -i ''s/"version": ".*"/"version": "${{ github.event.inputs.version }}"/'' package.json ${{ github.event.inputs.package }}/package.json ${{ github.event.inputs.package }}/jsr.jsonc' run: 'sed -i ''s/"version": ".*"/"version": "${{ github.event.inputs.version }}"/'' package.json ${{ github.event.inputs.package }}/package.json ${{ github.event.inputs.package }}/jsr.jsonc'
- name: Publish to NPM - name: Publish to NPM
if: ${{ github.event.inputs.registry == 'npm' }}
run: cd ${{ github.event.inputs.package }} && npm publish --provenance --tag ${{ github.event.inputs.tag }} --access public run: cd ${{ github.event.inputs.package }} && npm publish --provenance --tag ${{ github.event.inputs.tag }} --access public
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to JSR - name: Publish to JSR
if: ${{ github.event.inputs.registry == 'jsr' }}
run: cd ${{ github.event.inputs.package }} && bun install --frozen-lockfile && bunx jsr publish --allow-slow-types --allow-dirty run: cd ${{ github.event.inputs.package }} && bun install --frozen-lockfile && bunx jsr publish --allow-slow-types --allow-dirty