Skip to content

Commit 72d0e9d

Browse files
committed
update project
1 parent 916c822 commit 72d0e9d

32 files changed

+3365
-3206
lines changed

.gitattributes

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gradle"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 10
8+
ignore:
9+
- dependency-name: "*"
10+
update-types: ["version-update:semver-major"]
11+
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: "weekly"
16+
open-pull-requests-limit: 10
17+
ignore:
18+
- dependency-name: "*"
19+
update-types: ["version-update:semver-major"]

.github/workflows/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
on:
2+
pull_request:
3+
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: github.event.pull_request.user.login == 'dependabot[bot]'
12+
steps:
13+
- id: metadata
14+
uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a
15+
with:
16+
github-token: "${{ secrets.GITHUB_TOKEN }}"
17+
18+
- if: steps.metadata.outputs.update-type != 'version-update:semver-major'
19+
run: gh pr merge --auto --squash "$PR_URL"
20+
env:
21+
PR_URL: ${{ github.event.pull_request.html_url }}
22+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/gradle.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
on:
2+
workflow_dispatch:
3+
push:
4+
branches: [ main ]
5+
paths: [ src/**, build.gradle.kts, settings.gradle.kts ]
6+
7+
permissions:
8+
contents: write
9+
actions: read
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: actions/setup-java@v4
23+
with:
24+
distribution: temurin
25+
java-version: 21
26+
27+
- uses: gradle/actions/setup-gradle@v4
28+
29+
- run: |
30+
gradle wrapper
31+
chmod +x ./gradlew
32+
./gradlew jar
33+
34+
- id: vars
35+
run: |
36+
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
37+
./gradlew -q printVars | sed 's/ = /=/g' >> "$GITHUB_OUTPUT"
38+
39+
- id: ghck
40+
run: |
41+
CODE=$(curl -s -o /dev/null -w "%{http_code}" \
42+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
43+
-H "X-GitHub-Api-Version: 2022-11-28" \
44+
"https://api.github.com/repos/${{ github.repository }}/releases/tags/v${{ steps.vars.outputs.VERS }}")
45+
if [ "$CODE" = "200" ]; then
46+
echo "EXISTS=true" >> "$GITHUB_OUTPUT"
47+
else
48+
echo "EXISTS=false" >> "$GITHUB_OUTPUT"
49+
fi
50+
51+
- id: dist
52+
run: |
53+
echo "TAG_NAME=${{ format('v{0}{1}', steps.vars.outputs.VERS, steps.ghck.outputs.EXISTS == 'true' && format('+{0}', steps.vars.outputs.COMMIT_HASH) || '') }}" >> "$GITHUB_OUTPUT"
54+
echo "REL_NAME=${{ format('{0}{1}', steps.ghck.outputs.EXISTS == 'true' && 'Snapshot ' || 'v', steps.ghck.outputs.EXISTS == 'true' && steps.vars.outputs.COMMIT_HASH || steps.vars.outputs.VERS) }}" >> "$GITHUB_OUTPUT"
55+
echo "ART_NAME=${{ format('{0}{1}.jar', steps.vars.outputs.AFCT, steps.ghck.outputs.EXISTS == 'true' && format('+{0}', steps.vars.outputs.COMMIT_HASH) || '') }}" >> "$GITHUB_OUTPUT"
56+
57+
- run: |
58+
mkdir -p dist
59+
cp "./build/libs/${{ steps.vars.outputs.AFCT }}.jar" ./dist/${{ steps.dist.outputs.ART_NAME }}
60+
61+
- uses: actions/upload-artifact@v4
62+
with:
63+
path: dist/${{ steps.dist.outputs.ART_NAME }}
64+
name: ${{ steps.dist.outputs.ART_NAME }}
65+
66+
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
67+
uses: softprops/action-gh-release@v2
68+
with:
69+
tag_name: ${{ steps.dist.outputs.TAG_NAME }}
70+
name: ${{ steps.dist.outputs.REL_NAME }}
71+
files: dist/${{ steps.dist.outputs.ART_NAME }}
72+
prerelease: ${{ steps.ghck.outputs.EXISTS == 'true' }}
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
.gradle
2-
.idea
3-
build
4-
gradle
5-
libs
6-
gradlew
7-
gradlew.bat
8-
src/main/resources/*.png
1+
/.gradle/
2+
/.vscode/
3+
/.idea/
4+
/gradle/
5+
/build/
6+
/bin/
7+
/run/
8+
/gradlew
9+
/gradlew.bat
File renamed without changes.

build.gradle

Lines changed: 0 additions & 14 deletions
This file was deleted.

build.gradle.kts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import org.gradle.language.jvm.tasks.ProcessResources
2+
3+
4+
5+
6+
val PLUGIN_NAME = "ayunViaProxyEagUtils"
7+
val PLUGIN_VERS = "1.1"
8+
val PLUGIN_ATHR = "ayunami2000"
9+
val PLUGIN_CODE = "me.$PLUGIN_ATHR.$PLUGIN_NAME"
10+
11+
12+
13+
14+
plugins {
15+
id("java")
16+
}
17+
18+
java {
19+
sourceCompatibility = JavaVersion.VERSION_17
20+
targetCompatibility = JavaVersion.VERSION_17
21+
}
22+
23+
repositories {
24+
mavenCentral()
25+
maven("https://repo.viaversion.com")
26+
}
27+
28+
dependencies {
29+
compileOnly("net.raphimc:ViaProxy:3.4.9-SNAPSHOT")
30+
}
31+
32+
tasks.named<JavaCompile>("compileJava") {
33+
options.encoding = "UTF-8"
34+
options.release.set(17)
35+
}
36+
37+
tasks.named<ProcessResources>("processResources") {
38+
outputs.upToDateWhen { false }
39+
40+
doFirst {
41+
filesMatching("viaproxy.yml") {
42+
expand(mapOf(
43+
"plugin_name" to PLUGIN_NAME,
44+
"plugin_vers" to PLUGIN_VERS,
45+
"plugin_athr" to PLUGIN_ATHR,
46+
"plugin_code" to PLUGIN_CODE
47+
))
48+
}
49+
}
50+
}
51+
52+
tasks.named<Jar>("jar") {
53+
doFirst {
54+
delete(layout.buildDirectory.dir("libs"))
55+
mkdir(layout.buildDirectory.dir("libs"))
56+
}
57+
58+
archiveFileName.set("$PLUGIN_NAME-$PLUGIN_VERS.jar")
59+
}
60+
61+
tasks.register("printVars") {
62+
doLast {
63+
println("VERS = " + PLUGIN_VERS)
64+
println("AFCT = " + tasks.named("jar").get().outputs.files.singleFile.name.removeSuffix(".jar"))
65+
}
66+
}

settings.gradle

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)