Skip to content

Commit

Permalink
build: establish global ci
Browse files Browse the repository at this point in the history
  • Loading branch information
marrouchi committed Dec 10, 2024
1 parent 840cb2f commit 21b3c54
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 12 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/hexabot-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 49 additions & 0 deletions bump-version.sh
Original file line number Diff line number Diff line change
@@ -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."
1 change: 1 addition & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ LICENSE
.next
*.swp
/scripts
*.sh
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 21b3c54

Please sign in to comment.