Skip to content

Commit 07db88f

Browse files
feat: setup ci
1 parent 2918701 commit 07db88f

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Setup Deno
15+
uses: denoland/setup-deno@v1
16+
with:
17+
deno-version: v2.x
18+
19+
- name: Run tests
20+
run: deno test
21+
22+
- name: Build for deno
23+
run: deno publish --dry-run
24+
25+
- name: Build for npm
26+
run: deno task build

.github/workflows/publish.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ on:
77
jobs:
88
publish:
99
runs-on: ubuntu-latest
10+
environment: production
1011

1112
permissions:
12-
contents: read
13+
contents: write
1314
id-token: write
1415

1516
steps:
1617
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
1720

1821
- name: Setup Deno
1922
uses: denoland/setup-deno@v1
@@ -23,5 +26,32 @@ jobs:
2326
- name: Run tests
2427
run: deno test
2528

26-
- name: Publish package
29+
- name: Build for npm
30+
run: deno task build
31+
32+
- name: Publish to jsr
2733
run: npx jsr publish
34+
35+
- name: Setup Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: 22
39+
registry-url: 'https://registry.npmjs.org'
40+
41+
- name: Publish to npm
42+
working-directory: ./dist
43+
run: npm publish --provenance --access public
44+
env:
45+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
46+
47+
- name: Create Release
48+
env:
49+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
run: |
51+
VERSION=$(jq -r .version deno.json)
52+
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
53+
echo "Tag v$VERSION already exists. Skipping release creation."
54+
else
55+
echo "Creating release for v$VERSION"
56+
gh release create "v$VERSION" --generate-notes
57+
fi

0 commit comments

Comments
 (0)