Skip to content

Commit 75b6593

Browse files
committed
Publish to JSR & npm
1 parent 715bcf0 commit 75b6593

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

.github/workflows/main.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,42 @@ jobs:
3737
- run: deno task dnt
3838
- run: bun run ./test_runner.js
3939
working-directory: ${{ github.workspace }}/npm/
40+
41+
publish:
42+
if: github.event_name == 'push'
43+
needs: [test]
44+
runs-on: ubuntu-latest
45+
permissions:
46+
contents: read
47+
id-token: write
48+
steps:
49+
- uses: actions/checkout@v4
50+
- uses: denoland/setup-deno@v1
51+
with:
52+
deno-version: v1.x
53+
- uses: actions/setup-node@v4
54+
with:
55+
node-version: lts/*
56+
- if: github.ref_type == 'branch'
57+
run: |
58+
jq \
59+
--arg build "$GITHUB_RUN_NUMBER" \
60+
--arg commit "${GITHUB_SHA::8}" \
61+
'.version = .version + "-dev." + $build + "+" + $commit' \
62+
deno.json > deno.json.tmp
63+
mv deno.json.tmp deno.json
64+
- if: github.ref_type == 'tag'
65+
run: '[[ "$(jq -r .version deno.json)" = "$GITHUB_REF_NAME" ]]'
66+
- run: 'deno task dnt "$(jq -r .version deno.json)"'
67+
- run: |
68+
set -ex
69+
npm config set //registry.npmjs.org/:_authToken "$NPM_AUTH_TOKEN"
70+
if [[ "$GITHUB_REF_TYPE" = "tag" ]]; then
71+
npm publish --provenance --access public
72+
else
73+
npm publish --provenance --access public --tag dev
74+
fi
75+
env:
76+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
77+
working-directory: ${{ github.workspace }}/npm/
78+
- run: deno publish --allow-dirty

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,15 @@
33
@fedify/redis
44
=============
55

6+
[![JSR][JSR badge]][JSR]
7+
[![npm][npm badge]][npm]
8+
[![GitHub Actions][GitHub Actions badge]][GitHub Actions]
9+
610
Redis drivers for Fedify.
11+
12+
[JSR]: https://jsr.io/@fedify/redis
13+
[JSR badge]: https://jsr.io/badges/@fedify/redis
14+
[npm]: https://www.npmjs.com/package/@fedify/redis
15+
[npm badge]: https://img.shields.io/npm/v/@fedify/redis?logo=npm
16+
[GitHub Actions]: https://github.com/dahlia/fedify-redis/actions/workflows/main.yaml
17+
[GitHub Actions badge]: https://github.com/dahlia/fedify-redis/actions/workflows/main.yaml/badge.svg

0 commit comments

Comments
 (0)