Skip to content

Commit

Permalink
Add a build and a release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanUkhov committed Jul 15, 2024
1 parent 41b3666 commit d6ec400
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 2 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build

on:
pull_request:
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
check:
name: Run the checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- run: npm ci
- run: npm run check

test:
name: Run the tests
runs-on: ubuntu-latest
environment: staging
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- run: npm install
- run: npm run test
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release

on:
push:
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
main:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: https://npm.pkg.github.com
scope: "@the-type-founders"
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Unicode Classifier
# Unicode Classifier [![Release][release-img]][release-url]

This is a TypeScript module that you can use to classify codepoints by their
category and script (writing system).
Expand Down Expand Up @@ -35,3 +35,6 @@ console.log(classify([56845]));
Codepoint categories and scripts data is automatically downloaded from the
Unicode website. To update the data, change `UNICODE_VERSION` in `src/update.ts`
and run `npm run update` to update the data file.

[release-img]: https://github.com/the-type-founders/unicode-classifier-js/actions/workflows/release.yml/badge.svg
[release-url]: https://github.com/the-type-founders/unicode-classifier-js/actions/workflows/release.yml
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"types": "dist/index.d.ts",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"check": "echo",
"test": "echo",
"update": "ts-node src/update.ts",
"prepare": "tsc"
},
Expand Down

0 comments on commit d6ec400

Please sign in to comment.