-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Hexastack/feat/npm-versionning
feat: npm versioning
- Loading branch information
Showing
4 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.github |
This file contains 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