Skip to content

Commit 501aa6f

Browse files
committed
feat: add workflows
1 parent 07029da commit 501aa6f

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed

.github/workflows/publish.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version bump type'
11+
required: true
12+
default: 'patch'
13+
type: choice
14+
options:
15+
- patch
16+
- minor
17+
- major
18+
19+
jobs:
20+
publish:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write
24+
id-token: write
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Setup Bun
34+
uses: oven-sh/setup-bun@v2
35+
with:
36+
bun-version: latest
37+
38+
- name: Install dependencies
39+
run: bun install
40+
41+
- name: Run linter
42+
run: bun run lint
43+
44+
- name: Run TypeScript check
45+
run: bun run lint:ts
46+
47+
- name: Run tests
48+
run: bun run test:run
49+
50+
- name: Build library
51+
run: bun run build
52+
53+
- name: Get current version
54+
id: get-version
55+
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
56+
57+
- name: Setup Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: '20'
61+
registry-url: 'https://registry.npmjs.org'
62+
63+
- name: Publish to npm
64+
run: npm publish --access public
65+
env:
66+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
67+
68+
- name: Create Git Tag
69+
run: |
70+
git config --global user.name "github-actions[bot]"
71+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
72+
git tag -a "v${{ steps.get-version.outputs.version }}" -m "Release v${{ steps.get-version.outputs.version }}"
73+
git push origin "v${{ steps.get-version.outputs.version }}"
74+
75+
- name: Create GitHub Release
76+
uses: actions/create-release@v1
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
with:
80+
tag_name: v${{ steps.get-version.outputs.version }}
81+
release_name: Release v${{ steps.get-version.outputs.version }}
82+
body: |
83+
## 🚀 Release v${{ steps.get-version.outputs.version }}
84+
85+
Published to npm: [@flowscape-ui/design-system-kit@${{ steps.get-version.outputs.version }}](https://www.npmjs.com/package/@flowscape-ui/design-system-kit/v/${{ steps.get-version.outputs.version }})
86+
87+
### Changes
88+
See [CHANGELOG.md](./CHANGELOG.md) for details.
89+
draft: false
90+
prerelease: false

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish to npm
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Semver increment to apply (patch|minor|major) before publish, or leave empty to use current version'
8+
required: false
9+
default: ''
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
cache: npm
25+
registry-url: 'https://registry.npmjs.org'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Optional version bump
31+
if: ${{ inputs.version != '' }}
32+
run: |
33+
npm version ${{ inputs.version }} -m "chore(release): %s"
34+
git push --follow-tags
35+
36+
- name: Lint (ESLint)
37+
run: npm run lint
38+
39+
- name: Typecheck (TS)
40+
run: npm run lint:ts
41+
42+
- name: Format check (Prettier)
43+
run: npm run format:check
44+
45+
- name: Build
46+
run: npm run build
47+
48+
- name: Publish
49+
env:
50+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
51+
run: npm publish --provenance

0 commit comments

Comments
 (0)