Skip to content

Commit da7efd0

Browse files
committed
Setup changeset release
1 parent 4824568 commit da7efd0

File tree

3 files changed

+71
-2
lines changed

3 files changed

+71
-2
lines changed

.github/workflows/release.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: 🦋 Changesets Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
name: 🦋 Changesets Release
11+
runs-on: ubuntu-latest
12+
if: |
13+
github.repository == 'supabase-community/supabase-management-js'
14+
outputs:
15+
published_packages: ${{ steps.changesets.outputs.publishedPackages }}
16+
published: ${{ steps.changesets.outputs.published }}
17+
steps:
18+
- name: 🛑 Cancel Previous Runs
19+
uses: styfle/[email protected]
20+
21+
- name: ⬇️ Checkout repo
22+
uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
26+
- name: ⎔ Setup node
27+
uses: actions/setup-node@v2
28+
with:
29+
node-version: 18
30+
cache: "npm"
31+
32+
- name: 📥 Download deps
33+
run: npm install
34+
35+
- name: 🔎 Type check
36+
run: npm run typecheck
37+
38+
- name: 🔐 Setup npm auth
39+
run: |
40+
echo "registry=https://registry.npmjs.org" >> ~/.npmrc
41+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
42+
43+
# This action has two responsibilities. The first time the workflow runs
44+
# (initial push to the `main` branch) it will create a new branch and
45+
# then open a PR with the related changes for the new version. After the
46+
# PR is merged, the workflow will run again and this action will build +
47+
# publish to npm.
48+
- name: 🚀 PR / Publish
49+
id: changesets
50+
uses: changesets/action@v1
51+
with:
52+
version: npm run changeset:version
53+
commit: "chore: Update version for release"
54+
title: "chore: Update version for release"
55+
publish: npm run changeset:release
56+
createGithubReleases: true
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,11 @@ npm exec changeset
9696
```
9797

9898
7. Create a branch, commit your changes, and open a Pull Request against the `main` branch in this repo.
99+
100+
### Regenerating types
101+
102+
The [v1.d.ts](./src/api/v1.d.ts) file is auto-generated based on the Supabase [OpenAPI spec](https://api.supabase.com/api/v1-json) file with the following command:
103+
104+
```sh
105+
npm run generate
106+
```

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
"build": "npm run clean && npm run build:tsup",
2323
"build:tsup": "tsup --dts-resolve",
2424
"typecheck": "tsc --noEmit",
25-
"generate": "openapi-typescript https://api.supabase.com/api/v1-json -o ./src/api/v1.d.ts"
25+
"generate": "openapi-typescript https://api.supabase.com/api/v1-json -o ./src/api/v1.d.ts",
26+
"changeset:version": "changeset version",
27+
"changeset:release": "npm run build && changeset publish"
2628
},
2729
"dependencies": {
2830
"openapi-fetch": "^0.6.1"
@@ -39,4 +41,4 @@
3941
"engines": {
4042
"node": ">=18.0.0"
4143
}
42-
}
44+
}

0 commit comments

Comments
 (0)