Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add npm publish #12

Merged
merged 6 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,30 @@ jobs:
- name: Teardown integration environment
run: npm run testenv:stop
if: always()

build-publish:
runs-on: ubuntu-latest
needs:
- lint
- test
steps:
- uses: actions/checkout@v2
rafaelcr marked this conversation as resolved.
Show resolved Hide resolved
with:
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
rafaelcr marked this conversation as resolved.
Show resolved Hide resolved
fetch-depth: 0
rafaelcr marked this conversation as resolved.
Show resolved Hide resolved
persist-credentials: false

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
rafaelcr marked this conversation as resolved.
Show resolved Hide resolved
id: semantic
# Only run on non-PR events or only PRs that aren't from forks
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
rafaelcr marked this conversation as resolved.
Show resolved Hide resolved
SEMANTIC_RELEASE_PACKAGE: ${{ github.event.repository.name }}
with:
semantic_version: 19
extra_plugins: |
@semantic-release/[email protected]
@semantic-release/[email protected]
[email protected]
32 changes: 32 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish npm package
rafaelcr marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
persist-credentials: false

- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Extract version from tag
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "Extracted tag version: $TAG_NAME"
npm version $TAG_NAME --no-git-tag-version

- run: npm ci

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# API Toolkit

/ / ▶ API Toolkit
/ --- / A comprehensive collection of tools designed by Hiro to simplify common tasks in
/ / API development.

[![NPM Package](https://img.shields.io/npm/v/@hirosystems/api-toolkit.svg?style=flat-square)](https://www.npmjs.org/package/@hirosystems/api-toolkit)

The API Toolkit Library is a comprehensive collection of tools designed by Hiro to simplify common
tasks in API development. This library provides functionalities for database management, application
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
},
"homepage": "https://github.com/hirosystems/api-toolkit#readme",
"prettier": "@stacks/prettier-config",
"engines": {
"node": ">=18"
},
"devDependencies": {
"@commitlint/cli": "^17.5.0",
"@commitlint/config-conventional": "^17.4.4",
Expand Down
Loading