Merge pull request #3 from Flowscape-UI/dev #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to npm | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version bump type' | |
required: true | |
default: 'patch' | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: latest | |
- name: Install dependencies | |
run: bun install | |
- name: Run linter | |
run: bun run lint | |
- name: Run TypeScript check | |
run: bun run lint:ts | |
- name: Run tests | |
run: bun run test:run | |
- name: Build library | |
run: bun run build | |
- name: Configure Git | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Bump version (manual trigger) | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
npm version ${{ github.event.inputs.version }} -m "chore: release v%s" | |
git push --follow-tags | |
- name: Bump version (auto patch on push) | |
if: github.event_name == 'push' | |
run: | | |
npm version patch -m "chore: release v%s" | |
git push --follow-tags | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Publish to npm | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Get package version | |
id: package-version | |
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.package-version.outputs.version }} | |
release_name: Release v${{ steps.package-version.outputs.version }} | |
body: | | |
## 🚀 Release v${{ steps.package-version.outputs.version }} | |
Published to npm: [@flowscape-ui/core-sdk@${{ steps.package-version.outputs.version }}](https://www.npmjs.com/package/@flowscape-ui/core-sdk/v/${{ steps.package-version.outputs.version }}) | |
### Changes | |
See [CHANGELOG.md](./CHANGELOG.md) for details. | |
draft: false | |
prerelease: false |