Skip to content

Commit aca9cf1

Browse files
committed
chore: add workflow to publish package on npm and github
1 parent dfff0b9 commit aca9cf1

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish to NPM and Release on Github
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
release-type:
6+
description: 'Release type (patch, minor, major)'
7+
required: true
8+
default: 'patch'
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
release:
20+
name: Bump Version, Build, and Publish to NPM
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Set up Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 20
33+
cache: "yarn"
34+
registry-url: "https://registry.npmjs.org"
35+
36+
- name: Install dependencies
37+
run: yarn install --immutable
38+
39+
- name: Configure Git
40+
run: |
41+
git config user.name "GitHub Actions"
42+
git config user.email "actions@github.com"
43+
44+
- name: Build package
45+
run: yarn prepare
46+
47+
- name: Release-it
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
51+
run: npx release-it ${{ inputs.release-type }} --ci --verbose

0 commit comments

Comments
Β (0)