Publish package #67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish package | |
on: | |
workflow_dispatch: | |
inputs: | |
publish_to_npm: | |
description: "Publish package to NPM" | |
required: false | |
type: boolean | |
default: true | |
publish_to_jsr: | |
description: "Publish package to JSR" | |
required: false | |
type: boolean | |
default: true | |
permissions: | |
contents: write | |
id-token: write | |
jobs: | |
publish_package: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Bun | |
uses: oven-sh/setup-bun@v1 | |
- id: changelog | |
name: Generate changelog | |
run: bun scripts/generate-changelog.ts | |
- name: Install modules | |
run: bun install | |
- name: Prepare to JSR publish | |
run: bun jsr | |
- name: Type-check | |
run: tsc --noEmit | |
- name: Setup Deno | |
uses: denoland/setup-deno@v1 | |
- name: Publish package to JSR | |
if: ${{ github.event.inputs.publish_to_jsr }} | |
run: deno publish --allow-dirty --unstable-sloppy-imports --allow-slow-types | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
registry-url: "https://registry.npmjs.org" | |
scope: "@gramio" | |
- name: Publish package to NPM | |
if: ${{ github.event.inputs.publish_to_npm }} | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: v${{ steps.changelog.outputs.version }} | |
name: v${{ steps.changelog.outputs.version }} | |
body: ${{ steps.changelog.outputs.changelog }} | |
draft: false | |
prerelease: false | |
generateReleaseNotes: true |