Skip to content

Commit 3ba43a4

Browse files
authored
BREAKING CHANGE|feat!
BREAKING CHANGE|feat!
2 parents 942d014 + 1ee9829 commit 3ba43a4

24 files changed

+1940
-235
lines changed
Lines changed: 113 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,146 @@
1-
name: Build and Release Plugin
1+
name: Build and Release with Semantic Version
22

33
on:
44
push:
55
branches:
6-
- dev # Виконується тільки для гілки dev
6+
- dev
7+
- main
78

89
jobs:
9-
build:
10+
build-and-release:
1011
runs-on: ubuntu-latest
11-
1212
steps:
13-
# Клонування репозиторію
14-
- name: Checkout repository
13+
# ------------------------------------------------
14+
# 1. Клонуємо репозиторій
15+
# ------------------------------------------------
16+
- name: Checkout
1517
uses: actions/checkout@v3
1618

17-
# Налаштування JDK
19+
# ------------------------------------------------
20+
# 2. Встановлюємо Java (для Gradle)
21+
# ------------------------------------------------
1822
- name: Set up JDK
1923
uses: actions/setup-java@v3
2024
with:
2125
distribution: 'temurin'
22-
java-version: '17' # Відповідає конфігурації Gradle
26+
java-version: '17'
27+
28+
# ------------------------------------------------
29+
# 3. Semantic Versioning (PaulHatch/semantic-version)
30+
# ------------------------------------------------
31+
- name: Determine Version
32+
id: version
33+
uses: PaulHatch/[email protected]
34+
with:
35+
tag_prefix: v
36+
major_pattern: /BREAKING CHANGE|feat!/ # Патерн для основного збільшення версії
37+
minor_pattern: /feat:/ # Патерн для незначного збільшення версії
38+
default_version: '0.1.0'
39+
search_commit_body: true
40+
bump_version: true # Автоматичне збільшення версії
41+
42+
# ------------------------------------------------
43+
# 4. Формуємо тег і назву JAR (залежно від гілки)
44+
# ------------------------------------------------
45+
- name: Prepare Tag Variables
46+
id: prepare_tag
47+
run: |
48+
BRANCH_NAME="${GITHUB_REF_NAME}" # "dev" або "main"
49+
RAW_VERSION="${{ steps.version.outputs.version }}" # Напр.: "1.2.3"
50+
TAG_PREFIX="v" # Префікс для тегу, який визначили вище.
2351
24-
# Збірка проєкту Gradle
52+
if [ "$BRANCH_NAME" = "dev" ]; then
53+
# Пререліз для dev
54+
NEW_TAG="${TAG_PREFIX}${RAW_VERSION}-dev"
55+
IS_PRERELEASE="true"
56+
JAR_NAME="BirthDay-${RAW_VERSION}-dev.jar"
57+
RELEASE_NAME="Dev Release BirthDay ${RAW_VERSION}"
58+
else
59+
# Стабільна версія (main)
60+
NEW_TAG="${TAG_PREFIX}${RAW_VERSION}"
61+
IS_PRERELEASE="false"
62+
JAR_NAME="BirthDay-${RAW_VERSION}.jar"
63+
RELEASE_NAME="Release BirthDay ${RAW_VERSION}"
64+
fi
65+
66+
echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
67+
echo "is_prerelease=$IS_PRERELEASE" >> $GITHUB_OUTPUT
68+
echo "jar_name=$JAR_NAME" >> $GITHUB_OUTPUT
69+
echo "release_name=$RELEASE_NAME" >> $GITHUB_OUTPUT
70+
71+
# ------------------------------------------------
72+
# 5. Збираємо проєкт (Gradle)
73+
# ------------------------------------------------
2574
- name: Build with Gradle
2675
run: ./gradlew shadowJar
2776

28-
# Перевірка створення JAR
29-
- name: Verify JAR file
30-
run: ls build/libs/*.jar
77+
# ------------------------------------------------
78+
# 6. Перейменовуємо JAR
79+
# ------------------------------------------------
80+
- name: Rename JAR
81+
run: |
82+
FILE=$(find build/libs -name '*.jar' | head -n 1)
83+
if [ -z "$FILE" ]; then
84+
echo "No JAR file found!"
85+
exit 1
86+
fi
87+
mv "$FILE" "build/libs/${{ steps.prepare_tag.outputs.jar_name }}"
88+
echo "Renamed to ${{ steps.prepare_tag.outputs.jar_name }}"
89+
90+
# ------------------------------------------------
91+
# 7. Створюємо і пушимо тег
92+
# ------------------------------------------------
93+
- name: Create and Push Tag
94+
run: |
95+
NEW_TAG="${{ steps.prepare_tag.outputs.new_tag }}"
96+
echo "Creating and pushing tag: $NEW_TAG"
3197
32-
# Створення релізу
98+
# Перевіряємо чи існує вже тег
99+
git fetch --tags
100+
if git rev-parse "$NEW_TAG" >/dev/null 2>&1; then
101+
echo "Tag $NEW_TAG already exists, deleting..."
102+
git tag -d "$NEW_TAG"
103+
git push origin --delete "$NEW_TAG"
104+
fi
105+
106+
git config user.name "github-actions"
107+
git config user.email "[email protected]"
108+
109+
git tag "$NEW_TAG" -m "Auto-bumped to $NEW_TAG"
110+
git push origin "$NEW_TAG"
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
114+
# ------------------------------------------------
115+
# 8. Створюємо GitHub Release
116+
# ------------------------------------------------
33117
- name: Create GitHub Release
34118
id: create_release
35119
uses: actions/create-release@v1
36120
with:
37-
tag_name: dev-${{ github.run_number }} # Унікальний тег для dev
38-
release_name: Development Release ${{ github.run_number }}
121+
tag_name: ${{ steps.prepare_tag.outputs.new_tag }}
122+
release_name: ${{ steps.prepare_tag.outputs.release_name }}
39123
body: |
40-
Це автоматичний реліз для гілки dev.
124+
**Автоматичний реліз** з гілки `${{ github.ref_name }}`
125+
126+
Версія: `${{ steps.version.outputs.version }}`
127+
(за версією semantic-version): `${{ steps.version.outputs.version_type }}`
128+
129+
JAR: `${{ steps.prepare_tag.outputs.jar_name }}`
41130
draft: false
42-
prerelease: true
131+
prerelease: ${{ steps.prepare_tag.outputs.is_prerelease }}
43132
env:
44133
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45134

46-
# Завантаження JAR у реліз
135+
# ------------------------------------------------
136+
# 9. Завантажуємо JAR у реліз
137+
# ------------------------------------------------
47138
- name: Upload Plugin JAR
48139
uses: actions/upload-release-asset@v1
49140
with:
50141
upload_url: ${{ steps.create_release.outputs.upload_url }}
51-
asset_path: build/libs/*-all.jar # Файл із залежностями, зібраний ShadowJar
52-
asset_name: ${{ github.repository }}-dev.jar # Назва репозиторію + "dev"
142+
asset_path: build/libs/${{ steps.prepare_tag.outputs.jar_name }}
143+
asset_name: ${{ steps.prepare_tag.outputs.jar_name }}
53144
asset_content_type: application/java-archive
145+
env:
146+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Birthday Plugin
2+
3+
A Minecraft plugin to celebrate players' birthdays with customizable features and integrations.
4+
5+
---
6+
7+
## Features
8+
9+
1. **Placeholders**
10+
- Use `%birthday_prefix%` and `%birthday_date%` placeholders in other plugins to display a player's birthday prefix and date.
11+
12+
2. **Integration with Oraxen and ItemAdder**
13+
- Customize the birthday prefix using Oraxen or ItemAdder glyphs.
14+
- Example: Use `(%oraxen_id%)` or directly insert a glyph symbol in the prefix.
15+
16+
3. **Birthday Presents**
17+
- Configure special gifts for players, delivered automatically on their birthdays.
18+
- Gifts can include custom items, materials, or other rewards.
19+
20+
4. **LuckPerms Integration**
21+
- Assign temporary permissions or perks as birthday rewards.
22+
- Example: Grant a donation rank or special privileges for a limited time.
23+
24+
5. **Discord Support**
25+
- Connect a Discord channel to receive birthday notifications.
26+
- Example message: "🎉 Happy Birthday to [Player]! 🎂"
27+
28+
---
29+
30+
## Commands and Permissions
31+
32+
### Commands:
33+
- **/birthday**
34+
View and interact with your birthday data.
35+
**Permission:** `birthday.use`
36+
37+
- **/birthday reload**
38+
Reload the plugin’s configuration files.
39+
**Permission:** `birthday.reload`
40+
41+
- **/birthday delete**
42+
Delete a player's birthday data.
43+
**Permission:** `birthday.delete`
44+
45+
- **/birthday list**
46+
List all stored birthday data on the server.
47+
**Permission:** `birthday.list`
48+
49+
- **/birthday present**
50+
Manage the birthday present system.
51+
**Permission:** `birthday.present`
52+
53+
- **/birthday present open**
54+
Add items to the birthday present configuration.
55+
**Permission:** `birthday.present.open`
56+
57+
- **/birthday present give [player]**
58+
Give the configured birthday present to a player.
59+
**Permission:** `birthday.present.give`
60+
61+
---
62+
63+
## Integration Tips
64+
65+
- **Placeholders:** Use placeholders with scoreboard or chat formatting plugins to dynamically display birthday-related information.
66+
- **Oraxen/ItemAdder:** Add custom glyphs to make birthday prefixes unique and visually appealing.
67+
- **LuckPerms:** Automatically grant temporary perks such as XP boosts, ranks, or permissions as part of the birthday celebration.
68+
- **Discord Notifications:** Share birthday announcements with your community in a linked Discord channel.
69+
70+
---
71+
72+
## Support
73+
74+
For assistance, feature requests, or bug reports, please reach out to us on Discord. Bring joy to your server with the Birthday Plugin! 🎉
75+
76+
77+
DISCORD: https://discord.gg/eA4YhNQRJM

build.gradle

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
plugins {
22
id 'java'
3-
id 'com.github.johnrengelman.shadow' version '7.1.0' // Плагін для shading
3+
id 'com.github.johnrengelman.shadow' version '8.1.1' // Плагін для shading
44
}
55

66
group = 'org.referix'
7-
version = '1.0-SNAPSHOT'
7+
version = '1.0.0'
88

99
repositories {
1010
mavenCentral()
@@ -23,22 +23,24 @@ repositories {
2323
maven {
2424
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
2525
}
26+
maven { url 'https://repo.luckperms.net/' }
2627
}
2728

2829
dependencies {
2930
compileOnly "io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT"
31+
implementation 'org.bstats:bstats-bukkit:3.0.0'
3032
implementation 'com.mojang:authlib:1.5.21'
31-
33+
compileOnly 'net.luckperms:api:5.4'
3234
compileOnly 'me.clip:placeholderapi:2.11.6'
3335
// JDBI Core
3436
implementation 'org.jdbi:jdbi3-core:3.38.0'
3537

3638
// SQLite JDBC драйвер
3739
implementation 'org.xerial:sqlite-jdbc:3.45.1.0'
40+
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
3841

3942
// Логування для JDBI (опціонально, для налагодження)
40-
implementation 'org.jdbi:jdbi3-sqlobject:3.38.0'
41-
runtimeOnly 'org.slf4j:slf4j-api:2.0.7'
43+
4244

4345
}
4446

@@ -70,11 +72,17 @@ processResources {
7072

7173
// ShadowJar конфігурація
7274
shadowJar {
73-
archiveClassifier.set('') // Замінює стандартний JAR
75+
archiveBaseName.set('BIRTHDAY') // Назва файлу
76+
archiveVersion.set('1.0.0-DEV') // Версія файлу
77+
archiveClassifier.set('') // Без класифікатора
78+
mergeServiceFiles()
7479
minimize()
7580
exclude 'org/sqlite/native/**'
81+
82+
// Переносим все зависимости в пространство имен org.referix.libs
7683
relocate 'org.jdbi', 'org.referix.libs.jdbi'
7784
relocate 'org.sqlite', 'org.referix.libs.sqlite'
85+
relocate 'org.bstats', 'org.referix.libs.bstats'
7886
}
7987

8088

0 commit comments

Comments
 (0)