Skip to content

Commit

Permalink
Merge pull request #3 from Hexastack/feat/npm-versionning
Browse files Browse the repository at this point in the history
feat: npm versioning
  • Loading branch information
marrouchi authored Dec 12, 2024
2 parents 4308d96 + 866ef38 commit 09461ea
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 4 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish NPM Package

on:
push:
tags:
- 'v*'
workflow_dispatch: # Allow manual trigger

jobs:
publish-package:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: 'package.json'

- name: Determine release type
id: determine-release
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
echo "tag=${{ github.ref_name }}" >> $GITHUB_ENV
if [[ "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.0$ ]]; then
echo "release=minor" >> $GITHUB_ENV
elif [[ "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "release=patch" >> $GITHUB_ENV
else
echo "release=none" >> $GITHUB_ENV
fi
else
echo "release=none" >> $GITHUB_ENV
fi
- name: Login to npm
if: env.release != 'none'
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org/'
node-version: '18'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish to npm
if: env.release != 'none'
run: npm publish
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
"version": "2.1.0",
"description": "The OpenAI ChatGPT Helper Extension for Hexabot Chatbot / Agent Builder to enable the LLM Capability",
"scripts": {
"release:common": "git push origin --tags && npm publish",
"release:patch": "npm version patch && npm run release:common",
"release:minor": "npm version minor && npm run release:common",
"release": "echo 'Please specify patch or minor: npm run release:patch or npm run release:minor'"
"release:patch": "npm version patch && git push origin main --tags",
"release:minor": "npm version minor && git push origin main --tags"
},
"dependencies": {
"openai": "^4.54.0"
Expand Down

0 comments on commit 09461ea

Please sign in to comment.