Skip to content

Commit

Permalink
feat(package): Publish to JSR
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanRT committed Oct 28, 2024
1 parent 0a47ea4 commit c0aa00c
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 8 deletions.
27 changes: 19 additions & 8 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,40 @@ on:
branches:
- main

permissions:
contents: write
pull-requests: write
id-token: write

jobs:
release-please:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
release-type: node
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}

- uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
if: ${{ steps.release.outputs.release_created }}

- run: npm ci
if: ${{ steps.release.outputs.release_created }}

- name: Publish to NPM
run: |
npm ci
npm publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.release_created }}

- name: Publish to JSR
run: |
npm run build --if-present
npx jsr publish
if: ${{ steps.release.outputs.release_created }}
21 changes: 21 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "@luanrt/jintr",
"version": "3.0.1",
"exports": "./src/index.ts",
"imports": {
"estree": "npm:@types/estree@^1.0.6",
"acorn": "npm:acorn@^8.8.0"
},
"publish": {
"include": [
"LICENSE",
"README.md",
"src/**/*.ts"
],
"exclude": [
"test",
"scripts",
"examples"
]
}
}
14 changes: 14 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"packages": {
".": {
"release-type": "node",
"extra-files": [
{
"type": "json",
"path": "jsr.json",
"jsonpath": "$.version"
}
]
}
}
}

0 comments on commit c0aa00c

Please sign in to comment.