feat(build): add release automation tasks and CI/CD workflows
Some checks failed
CI / test (push) Has been cancelled
Some checks failed
CI / test (push) Has been cancelled
- Introduced Gradle tasks for release preparation, version bumping, and git tagging. - Added CI workflow for continuous integration on pushes and pull requests. - Implemented release workflow for automated builds and Gitea releases upon tag pushes. - Created scripts for manual release processes on Windows and Linux/macOS. - Documented the release process and Gitea Actions setup in the new RELEASE.md and setup-gitea-actions.md files.
This commit is contained in:
74
scripts/release.sh
Normal file
74
scripts/release.sh
Normal file
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
# PlayHours Release Script for Linux/macOS
|
||||
# This script automates the release process
|
||||
|
||||
set -e
|
||||
|
||||
echo "Starting PlayHours release process..."
|
||||
|
||||
# Check if we're in a git repository
|
||||
if ! git status >/dev/null 2>&1; then
|
||||
echo "Error: Not in a git repository"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if there are uncommitted changes
|
||||
if ! git diff --quiet; then
|
||||
echo "Warning: You have uncommitted changes. Please commit them first."
|
||||
read -p "Do you want to continue anyway? (y/N): " choice
|
||||
if [[ ! "$choice" =~ ^[Yy]$ ]]; then
|
||||
echo "Release cancelled."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Get current version
|
||||
CURRENT_VERSION=$(grep "mod_version=" gradle.properties | cut -d'=' -f2)
|
||||
echo "Current version: $CURRENT_VERSION"
|
||||
|
||||
# Ask for new version
|
||||
read -p "Enter new version (current: $CURRENT_VERSION): " NEW_VERSION
|
||||
|
||||
if [ -z "$NEW_VERSION" ]; then
|
||||
echo "No version entered. Using current version."
|
||||
NEW_VERSION=$CURRENT_VERSION
|
||||
fi
|
||||
|
||||
# Update version in gradle.properties
|
||||
sed -i "s/mod_version=$CURRENT_VERSION/mod_version=$NEW_VERSION/" gradle.properties
|
||||
|
||||
# Build the project
|
||||
echo "Building project..."
|
||||
./gradlew clean build
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Build failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create git tag
|
||||
echo "Creating git tag v$NEW_VERSION..."
|
||||
git tag -a "v$NEW_VERSION" -m "Release v$NEW_VERSION"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to create tag!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Push changes and tags
|
||||
echo "Pushing changes and tags..."
|
||||
git push origin main
|
||||
git push origin "v$NEW_VERSION"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to push changes!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Release v$NEW_VERSION completed successfully!"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Go to your Gitea repository"
|
||||
echo "2. Create a new release with tag v$NEW_VERSION"
|
||||
echo "3. Upload the JAR file from build/libs/playhours-$NEW_VERSION.jar"
|
||||
echo "4. Add release notes"
|
||||
echo ""
|
||||
echo "JAR file location: build/libs/playhours-$NEW_VERSION.jar"
|
||||
Reference in New Issue
Block a user