-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add CI workflows for NPM package publish automation
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: publish | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- name: Check valid version tag | ||
run: | | ||
[[ "${{ github.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)? ]] || exit 1 | ||
- uses: actions/checkout@v4 | ||
- uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: latest | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: bun install --frozen-lockfile | ||
- run: bun run lint | ||
- run: bun run test | ||
- run: npm publish --provenance --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: release | ||
on: | ||
push: | ||
tags: [v*.*.*] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
- run: bun install --frozen-lockfile | ||
- run: bun run lint | ||
- run: bun run test | ||
- run: gh release create "${{ github.ref_name }}" --draft --generate-notes | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |