Skip to content

Commit 89a5180

Browse files
authored
release workflow (#7)
1 parent 80dc0a8 commit 89a5180

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

.github/workflows/lint.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,10 @@ jobs:
2626
git diff
2727
exit 1
2828
fi
29+
- run: |
30+
npm run version
31+
if [ "$(git diff | wc -l)" -gt "0" ]; then
32+
echo "Check version fail, please run 'npm run version' to fix."
33+
git diff
34+
exit 1
35+
fi

.github/workflows/publish.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish-npm:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: '16.x'
15+
registry-url: 'https://registry.npmjs.org'
16+
- run: npm ci
17+
- run: npm publish --access public
18+
env:
19+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

docs/dev-guide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# How to release
2+
3+
1. Update the version in `package.json` and run `npm run version`. Then merge the PR.
4+
2. Publish a new GitHub release.
5+
3. The npm pacakge will be published automatically.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"pretest": "npm run build",
2020
"test": "jest __tests__ --passWithNoTests",
2121
"integrationTest": "npm run build && jest integration-test --passWithNoTests",
22-
"version": "echo \"export const Version = '$npm_package_version'\" > src/version.ts && git add src/version.ts && npm run build",
22+
"version": "echo \"export const Version = '$npm_package_version'\" > src/version.ts",
2323
"prepublishOnly": "npm run build"
2424
},
2525
"prettier": {

0 commit comments

Comments
 (0)