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.
78 lines
2.0 KiB
Batchfile
78 lines
2.0 KiB
Batchfile
@echo off
|
|
REM PlayHours Release Script for Windows
|
|
REM This script automates the release process
|
|
|
|
echo Starting PlayHours release process...
|
|
|
|
REM Check if we're in a git repository
|
|
git status >nul 2>&1
|
|
if %errorlevel% neq 0 (
|
|
echo Error: Not in a git repository
|
|
exit /b 1
|
|
)
|
|
|
|
REM Check if there are uncommitted changes
|
|
git diff --quiet
|
|
if %errorlevel% neq 0 (
|
|
echo Warning: You have uncommitted changes. Please commit them first.
|
|
echo Do you want to continue anyway? (y/N)
|
|
set /p choice=
|
|
if /i not "%choice%"=="y" (
|
|
echo Release cancelled.
|
|
exit /b 1
|
|
)
|
|
)
|
|
|
|
REM Get current version
|
|
for /f "tokens=2 delims==" %%a in ('findstr "mod_version=" gradle.properties') do set CURRENT_VERSION=%%a
|
|
echo Current version: %CURRENT_VERSION%
|
|
|
|
REM Ask for new version
|
|
echo Enter new version (current: %CURRENT_VERSION%):
|
|
set /p NEW_VERSION=
|
|
|
|
if "%NEW_VERSION%"=="" (
|
|
echo No version entered. Using current version.
|
|
set NEW_VERSION=%CURRENT_VERSION%
|
|
)
|
|
|
|
REM Update version in gradle.properties
|
|
powershell -Command "(Get-Content gradle.properties) -replace 'mod_version=%CURRENT_VERSION%', 'mod_version=%NEW_VERSION%' | Set-Content gradle.properties"
|
|
|
|
REM Build the project
|
|
echo Building project...
|
|
call gradlew clean build
|
|
if %errorlevel% neq 0 (
|
|
echo Build failed!
|
|
exit /b 1
|
|
)
|
|
|
|
REM Create git tag
|
|
echo Creating git tag v%NEW_VERSION%...
|
|
git tag -a v%NEW_VERSION% -m "Release v%NEW_VERSION%"
|
|
if %errorlevel% neq 0 (
|
|
echo Failed to create tag!
|
|
exit /b 1
|
|
)
|
|
|
|
REM Push changes and tags
|
|
echo Pushing changes and tags...
|
|
git push origin main
|
|
git push origin v%NEW_VERSION%
|
|
if %errorlevel% neq 0 (
|
|
echo Failed to push changes!
|
|
exit /b 1
|
|
)
|
|
|
|
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
|
|
pause
|