name: release on: push: tags: - 'v*' - '@hono/*' permissions: contents: read jobs: npm: name: publish-to-npm if: startsWith(github.ref_name, 'v') runs-on: ubuntu-latest permissions: contents: read id-token: write steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 with: node-version-file: '.tool-versions' registry-url: 'https://registry.npmjs.org' - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 with: bun-version-file: '.tool-versions' - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 with: cache: true run_install: true - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 with: node-version-file: '.tool-versions' - run: npm install -g npm@11.17.0 - run: pnpm run build - name: Publish to npm run: npm stage publish --provenance --access public jsr: name: publish-to-jsr if: startsWith(github.ref_name, 'v') runs-on: ubuntu-latest permissions: contents: read id-token: write steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Install deno uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2 with: deno-version-file: '.tool-versions' - run: deno install --no-lock --allow-scripts - name: Publish to JSR run: deno run -A jsr:@david/publish-on-tag@0.1.4 adapter: name: publish-adapter-to-npm if: startsWith(github.ref_name, '@hono/') runs-on: ubuntu-latest permissions: contents: read id-token: write steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 with: node-version-file: '.tool-versions' registry-url: 'https://registry.npmjs.org' - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 with: bun-version-file: '.tool-versions' - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 with: cache: true run_install: true - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 with: node-version-file: '.tool-versions' - run: npm install -g npm@11.17.0 - name: Resolve package from tag id: pkg run: | # tag: @hono/@ pkg="${GITHUB_REF_NAME%@*}" echo "name=$pkg" >> "$GITHUB_OUTPUT" echo "dir=adapters/${pkg#@hono/}" >> "$GITHUB_OUTPUT" - run: pnpm --filter "${{ steps.pkg.outputs.name }}" run build - name: Pack run: pnpm --filter "${{ steps.pkg.outputs.name }}" pack --pack-destination "$RUNNER_TEMP" - name: Publish to npm run: npm stage publish "$RUNNER_TEMP"/*.tgz --provenance --access public # Adapters with a deno.json are also published to JSR - uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2 if: hashFiles(format('{0}/deno.json', steps.pkg.outputs.dir)) != '' with: deno-version-file: '.tool-versions' - name: Publish to JSR if: hashFiles(format('{0}/deno.json', steps.pkg.outputs.dir)) != '' working-directory: ${{ steps.pkg.outputs.dir }} # deno.json keeps version 0.0.0 in the repo; write the version from the tag before publishing, # like publish-on-tag does for hono's jsr.json run: | jq --arg version "${GITHUB_REF_NAME##*@}" '.version = $version' deno.json > deno.json.tmp mv deno.json.tmp deno.json deno publish --allow-dirty