Skip to content

Commit 3c27b22

Browse files
committed
add: init
0 parents  commit 3c27b22

File tree

18 files changed

+2269
-0
lines changed

18 files changed

+2269
-0
lines changed

.gitattributes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Handle line endings automatically for files detected as text
2+
* text=auto
3+
4+
# Force LF for shell scripts (Unix line endings)
5+
*.sh text eol=lf
6+
gradlew text eol=lf
7+
8+
# Force CRLF for Windows batch files
9+
*.bat text eol=crlf
10+
11+
# Binary files
12+
*.jar binary
13+
*.class binary
14+

.github/workflows/release.yml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
paths-ignore:
7+
- '**.md'
8+
- '.gitignore'
9+
- 'LICENSE'
10+
pull_request:
11+
branches: [ main, master ]
12+
paths-ignore:
13+
- '**.md'
14+
- '.gitignore'
15+
- 'LICENSE'
16+
workflow_dispatch:
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: write
23+
packages: write
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Set up JDK 21
32+
uses: actions/setup-java@v4
33+
with:
34+
java-version: '21'
35+
distribution: 'temurin'
36+
cache: gradle
37+
38+
- name: Validate Gradle wrapper
39+
uses: gradle/wrapper-validation-action@v2
40+
41+
- name: Setup Gradle
42+
uses: gradle/actions/setup-gradle@v3
43+
44+
- name: Make Gradle wrapper executable
45+
run: chmod +x ./gradlew
46+
47+
- name: Extract version
48+
id: extract_version
49+
run: |
50+
VERSION=$(grep "^version = " build.gradle | sed "s/version = '\(.*\)'/\1/")
51+
echo "VERSION=$VERSION" >> $GITHUB_ENV
52+
echo "version=$VERSION" >> $GITHUB_OUTPUT
53+
COMMIT_SHA_SHORT=$(git rev-parse --short HEAD)
54+
echo "COMMIT_SHA_SHORT=$COMMIT_SHA_SHORT" >> $GITHUB_ENV
55+
echo "Version: $VERSION (Commit: $COMMIT_SHA_SHORT)"
56+
57+
- name: Check if tag exists
58+
id: check_tag
59+
run: |
60+
if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then
61+
echo "exists=true" >> $GITHUB_OUTPUT
62+
echo "Tag v${{ env.VERSION }} already exists"
63+
else
64+
echo "exists=false" >> $GITHUB_OUTPUT
65+
echo "Tag v${{ env.VERSION }} does not exist"
66+
fi
67+
68+
- name: Build with Gradle
69+
run: ./gradlew clean build --no-daemon
70+
71+
- name: Run tests
72+
run: ./gradlew test --no-daemon
73+
74+
- name: Upload build artifacts
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: PluginUpdateCore-${{ env.VERSION }}-build-${{ env.COMMIT_SHA_SHORT }}
78+
path: build/libs/*.jar
79+
retention-days: 90
80+
81+
- name: Upload test reports on failure
82+
if: failure()
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: test-reports-${{ env.COMMIT_SHA_SHORT }}
86+
path: build/reports/tests/
87+
retention-days: 7
88+
89+
- name: Create Git Tag
90+
if: github.event_name == 'push' && steps.check_tag.outputs.exists == 'false'
91+
run: |
92+
git config user.name "github-actions[bot]"
93+
git config user.email "github-actions[bot]@users.noreply.github.com"
94+
git tag -a "v${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}"
95+
git push origin "v${{ env.VERSION }}"
96+
97+
- name: Create GitHub Release
98+
if: github.event_name == 'push' && steps.check_tag.outputs.exists == 'false'
99+
uses: softprops/action-gh-release@v2
100+
with:
101+
tag_name: v${{ env.VERSION }}
102+
name: Release v${{ env.VERSION }}
103+
body: |
104+
## PluginUpdateCore v${{ env.VERSION }}
105+
106+
### 📦 Artifacts
107+
- Main JAR: `PluginUpdateCore-${{ env.VERSION }}.jar`
108+
- Sources JAR: `PluginUpdateCore-${{ env.VERSION }}-sources.jar`
109+
- Javadoc JAR: `PluginUpdateCore-${{ env.VERSION }}-javadoc.jar`
110+
111+
### 📝 Changes
112+
Built from commit: `${{ env.COMMIT_SHA_SHORT }}`
113+
114+
### 📚 Documentation
115+
See [README.md](https://github.com/${{ github.repository }}/blob/main/README.md) for usage instructions.
116+
117+
### 🔗 Maven Dependency
118+
```xml
119+
<dependency>
120+
<groupId>com.github.NighterDevelopment</groupId>
121+
<artifactId>PluginUpdateCore</artifactId>
122+
<version>${{ env.VERSION }}</version>
123+
</dependency>
124+
```
125+
126+
### 🔗 Gradle Dependency (Kotlin DSL)
127+
```kotlin
128+
implementation("com.github.NighterDevelopment:PluginUpdateCore:${{ env.VERSION }}")
129+
```
130+
131+
### 🔗 Gradle Dependency (Groovy)
132+
```groovy
133+
implementation 'com.github.NighterDevelopment:PluginUpdateCore:${{ env.VERSION }}'
134+
```
135+
draft: false
136+
prerelease: false
137+
files: |
138+
build/libs/*.jar
139+
fail_on_unmatched_files: false
140+
env:
141+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
142+
143+
- name: Release Summary
144+
if: github.event_name == 'push'
145+
run: |
146+
if [ "${{ steps.check_tag.outputs.exists }}" == "true" ]; then
147+
echo "✅ Build completed successfully"
148+
echo "ℹ️ Release v${{ env.VERSION }} already exists, skipping release creation"
149+
else
150+
echo "✅ Build completed successfully"
151+
echo "🚀 Release v${{ env.VERSION }} created successfully"
152+
echo "📦 Artifacts uploaded to GitHub Release"
153+
fi

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Gradle
2+
.gradle/
3+
build/
4+
out/
5+
bin/
6+
7+
# IDE
8+
.idea/
9+
*.iml
10+
*.ipr
11+
*.iws
12+
.vscode/
13+
.settings/
14+
.classpath
15+
.project
16+
17+
# OS
18+
.DS_Store
19+
Thumbs.db
20+
21+
# Other
22+
*.log
23+
*.jar
24+
!gradle/wrapper/gradle-wrapper.jar

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 NighterDevelopment
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)