You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-19 15:06:19 +00:00
Update added git action to build jar automatically with incremental release
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
name: Build & Release JAR
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-release:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: Emulator
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
cache: maven
|
||||
|
||||
- name: Bump patch version
|
||||
id: bump
|
||||
run: |
|
||||
CURRENT=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
|
||||
echo "Current version: $CURRENT"
|
||||
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
|
||||
NEW="$MAJOR.$MINOR.$((PATCH + 1))"
|
||||
echo "New version: $NEW"
|
||||
mvn -B versions:set -DnewVersion="$NEW" -DgenerateBackupPoms=false
|
||||
echo "new_version=$NEW" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build JAR
|
||||
run: mvn -B clean package -DskipTests
|
||||
|
||||
- name: Commit bumped pom.xml
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add pom.xml
|
||||
git commit -m "🆙 Bump version to ${{ steps.bump.outputs.new_version }} [skip ci]"
|
||||
git push origin HEAD:main
|
||||
|
||||
- name: Generate release notes from commits
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
PREV_TAG=$(git tag --sort=-creatordate | head -n1 || true)
|
||||
NEW_TAG="v${{ steps.bump.outputs.new_version }}"
|
||||
if [ -z "$PREV_TAG" ]; then
|
||||
RANGE="HEAD"
|
||||
COMPARE_LINE=""
|
||||
else
|
||||
RANGE="${PREV_TAG}..HEAD"
|
||||
COMPARE_LINE="**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${NEW_TAG}"
|
||||
fi
|
||||
{
|
||||
echo "## What's Changed in ${NEW_TAG}"
|
||||
echo ""
|
||||
git log --no-merges --pretty=format:"### %s%n%n%b%n---" $RANGE
|
||||
echo ""
|
||||
echo ""
|
||||
[ -n "$COMPARE_LINE" ] && echo "$COMPARE_LINE"
|
||||
} > release_notes.md
|
||||
cat release_notes.md
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: v${{ steps.bump.outputs.new_version }}
|
||||
name: Release v${{ steps.bump.outputs.new_version }}
|
||||
body_path: release_notes.md
|
||||
files: Emulator/target/Habbo-${{ steps.bump.outputs.new_version }}-jar-with-dependencies.jar
|
||||
Reference in New Issue
Block a user