Skip to content

Commit 4bdc71a

Browse files
committed
Add GitHub actions publish workflow
1 parent 8eac900 commit 4bdc71a

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/publish.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Publish to NPM
2+
3+
permissions:
4+
contents: write
5+
id-token: write
6+
packages: write
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: "Version bump type"
13+
required: true
14+
type: choice
15+
options:
16+
- patch
17+
- minor
18+
- major
19+
default: patch
20+
21+
jobs:
22+
publish:
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v5
28+
with:
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v6
33+
with:
34+
node-version: 24.x
35+
36+
- name: Log NPM version
37+
run: npm -v
38+
39+
- name: Configure git
40+
run: |
41+
git config user.name "github-actions[bot]"
42+
git config user.email "github-actions[bot]@users.noreply.github.com"
43+
44+
- name: Install dependencies
45+
run: npm ci
46+
47+
- name: Run format check
48+
run: npm run format:check
49+
50+
- name: Run linter
51+
run: npm run lint
52+
53+
- name: Build application
54+
run: npm run build
55+
56+
- name: Run tests
57+
run: npm test
58+
59+
- name: Bump version
60+
run: npm version ${{ inputs.version }} -m "🔖 @huggingface/tokenizers@%s"
61+
62+
- name: Get new version
63+
id: package-version
64+
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
65+
66+
- name: Push changes
67+
run: |
68+
git push
69+
git push --tags
70+
71+
- name: Publish to NPM
72+
run: npm publish

0 commit comments

Comments
 (0)