Skip to content

Commit

Permalink
feat: add auto release job for NPM (JS) package (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
fospring authored Apr 1, 2024
1 parent 51e4211 commit 37255f6
Show file tree
Hide file tree
Showing 3 changed files with 4,276 additions and 2,066 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./npm
permissions:
contents: write
issues: write
pull-requests: write
environment: NPM
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install Dependencies
run: npm install

- name: Build Packages
run: npm build

- name: Create Release Pull Request or Publish to NPM
# use changesets/action to create PR and auto release
uses: changesets/action@v1
with:
publish: npm release
commit: "chore(release): publish packages"
title: "Publish packages"
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
7 changes: 6 additions & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"tar": "^6.2.0"
},
"devDependencies": {
"@changesets/changelog-github": "0.4.6",
"@changesets/cli": "2.24.4",
"@commitlint/cli": "17.0.3",
"@commitlint/config-conventional": "17.0.3",
"@sindresorhus/tsconfig": "^2.0.0",
"@types/node": "^16.4.10",
"@types/tar": "^4.0.5",
Expand All @@ -28,7 +32,8 @@
"postinstall": "node ./install.js",
"preinstall": "node ./uninstall.js",
"test": "ava",
"build": "tsc"
"build": "tsc",
"release": "changeset publish"
},
"files": [
"*.js",
Expand Down
Loading

0 comments on commit 37255f6

Please sign in to comment.