build: establish global ci

This commit is contained in:
Mohamed Marrouchi 2024-12-10 11:47:04 +01:00
parent 840cb2fef3
commit 21b3c54d42
5 changed files with 57 additions and 12 deletions

View File

@ -55,9 +55,4 @@ jobs:
- name: Publish to npm
if: env.release != 'none'
run: |
if [[ "$release" == "patch" ]]; then
npm run release:patch
elif [[ "$release" == "minor" ]]; then
npm run release:minor
fi
run: npm publish

49
bump-version.sh Executable file
View File

@ -0,0 +1,49 @@
#!/bin/bash
# Ensure script exits on any command failure
set -e
# Check if a release type argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 <release-type>"
echo "release-type: patch | minor"
exit 1
fi
RELEASE_TYPE=$1
ROOT_DIR=$(pwd)
if [[ "$RELEASE_TYPE" != "patch" && "$RELEASE_TYPE" != "minor" ]]; then
echo "Invalid release type. Use 'patch' or 'minor'."
exit 1
fi
echo "Executing release: $RELEASE_TYPE"
# Execute the appropriate npm release command
if [[ "$RELEASE_TYPE" == "patch" ]]; then
npm run release:patch
elif [[ "$RELEASE_TYPE" == "minor" ]]; then
npm run release:minor
fi
# Retrieve the new version from package.json
NEW_VERSION=$(jq -r '.version' "$ROOT_DIR/package.json")
if [ -z "$NEW_VERSION" ]; then
echo "Failed to retrieve the version from package.json."
exit 1
fi
# Commit and push changes
echo "Committing and pushing changes..."
git add .
git commit -m "build: v$NEW_VERSION"
# Add git tag
echo "Tagging version v$NEW_VERSION"
git tag "v$NEW_VERSION"
git push origin main --tags
echo "Release ($RELEASE_TYPE) completed successfully."

View File

@ -11,3 +11,4 @@ LICENSE
.next
*.swp
/scripts
*.sh

8
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "hexabot",
"version": "2.0.0",
"version": "2.0.17",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "hexabot",
"version": "2.0.0",
"version": "2.0.17",
"license": "AGPL-3.0-only",
"workspaces": [
"frontend",
@ -45,7 +45,7 @@
},
"frontend": {
"name": "hexabot-ui",
"version": "2.0.0",
"version": "2.0.18",
"license": "AGPL-3.0-only",
"dependencies": {
"@chatscope/chat-ui-kit-react": "^2.0.3",
@ -9771,7 +9771,7 @@
},
"widget": {
"name": "hexabot-chat-widget",
"version": "2.0.3",
"version": "2.0.18",
"license": "AGPL-3.0-only",
"dependencies": {
"@types/emoji-js": "^3.5.2",

View File

@ -15,8 +15,8 @@
"dev:widget": "npm run dev --workspace=widget",
"release:api:patch": "cd api/ && npm version --git-tag-version false --commit-hooks false patch",
"release:api:minor": "cd api/ && npm version --git-tag-version false --commit-hooks false minor",
"release:patch": "npm run release:api:patch && npm version patch --workspaces && git push origin main --tags",
"release:minor": "npm run release:api:minor && npm version minor --workspaces && git push origin main --tags"
"release:patch": "npm run release:api:patch && npm version --git-tag-version false --commit-hooks false --workspaces patch",
"release:minor": "npm run release:api:minor && npm version --git-tag-version false --commit-hooks false --workspaces minor"
},
"devDependencies": {
"@commitlint/cli": "^19.3.0",