diff --git a/README.md b/README.md index f1607c4..e96898f 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ Welcome to the **Keylogger Project**! This project demonstrates how a keylogger ├── /logs # Log files directory (created automatically) ├── /docs # Documentation │ └── manual.sh # Educational information script +├── /scripts # Utility scripts +│ └── create-release.sh # Script to create releases ├── /github # GitHub workflows and configs ├── setup.sh # Setup script ├── requirements.txt # Python dependencies @@ -244,16 +246,24 @@ See our [Contributors Hall of Fame](CONTRIBUTORS.md) to view all the amazing peo ### Creating Releases -Releases can be created in two ways: +Releases can be created in three ways: -1. **Using Git tags** (recommended): +1. **Using the release script** (recommended): ```bash - git tag v1.0.0 + ./scripts/create-release.sh + # Or with a specific version: + ./scripts/create-release.sh v1.0.0 + ``` + This interactive script validates the version, creates a tag, and pushes it. + +2. **Using Git tags**: + ```bash + git tag -a v1.0.0 -m "Release v1.0.0" git push origin v1.0.0 ``` This automatically triggers the release workflow. -2. **Manual workflow dispatch**: +3. **Manual workflow dispatch**: - Go to Actions → Create Release - Click "Run workflow" - Enter the version (e.g., `v1.0.0`) diff --git a/scripts/create-release.sh b/scripts/create-release.sh new file mode 100755 index 0000000..8683965 --- /dev/null +++ b/scripts/create-release.sh @@ -0,0 +1,83 @@ +#!/bin/bash +# Script to create a release for the Keylogger project +# This script creates a Git tag and pushes it to trigger the release workflow + +set -e + +# Default version from VERSION file +DEFAULT_VERSION=$(cat VERSION 2>/dev/null || echo "1.0.0") + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +echo -e "${GREEN}========================================${NC}" +echo -e "${GREEN} Keylogger Release Creator${NC}" +echo -e "${GREEN}========================================${NC}" +echo "" + +# Get version from argument or prompt +if [ -n "$1" ]; then + VERSION="$1" +else + echo -e "Current version in VERSION file: ${YELLOW}${DEFAULT_VERSION}${NC}" + read -p "Enter release version (e.g., v1.0.0) [v${DEFAULT_VERSION}]: " VERSION + VERSION=${VERSION:-"v${DEFAULT_VERSION}"} +fi + +# Ensure version starts with 'v' +if [[ ! "$VERSION" =~ ^v ]]; then + VERSION="v${VERSION}" +fi + +# Validate version format +if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then + echo -e "${RED}Error: Version must follow semantic versioning (e.g., v1.0.0 or v1.0.0-beta.1)${NC}" + exit 1 +fi + +echo "" +echo -e "Creating release: ${GREEN}${VERSION}${NC}" +echo "" + +# Check if tag already exists locally +if git tag -l | grep -q "^${VERSION}$"; then + echo -e "${YELLOW}Warning: Tag ${VERSION} already exists locally${NC}" + read -p "Do you want to delete and recreate it? (y/n) [n]: " DELETE_TAG + if [[ "$DELETE_TAG" =~ ^[Yy]$ ]]; then + git tag -d "$VERSION" + echo -e "${GREEN}Deleted local tag ${VERSION}${NC}" + else + echo "Aborting." + exit 1 + fi +fi + +# Check if tag exists on remote +if git ls-remote --tags origin | grep -q "refs/tags/${VERSION}$"; then + echo -e "${RED}Error: Tag ${VERSION} already exists on remote${NC}" + echo "Please use a different version number." + exit 1 +fi + +# Create the tag +echo -e "Creating tag ${GREEN}${VERSION}${NC}..." +git tag -a "$VERSION" -m "Release ${VERSION}" + +# Push the tag +echo -e "Pushing tag to origin..." +git push origin "$VERSION" + +echo "" +echo -e "${GREEN}========================================${NC}" +echo -e "${GREEN} Release Created Successfully!${NC}" +echo -e "${GREEN}========================================${NC}" +echo "" +echo "The GitHub Actions release workflow has been triggered." +echo "Check the Actions tab on GitHub to monitor the build progress." +echo "" +echo "Release URL (once complete):" +echo " https://github.com/Stalin-143/Keylogger/releases/tag/${VERSION}" +echo ""