Skip to content

Commit a38d2cd

Browse files
Add build.yml, include LICENSE in shadowJar (#1)
1 parent 1604bf4 commit a38d2cd

2 files changed

Lines changed: 71 additions & 15 deletions

File tree

.github/build.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths-ignore:
7+
- '.idea/copyright/*.xml'
8+
- '.gitignore'
9+
- 'LICENSE'
10+
- 'README.md'
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Setup Gradle
18+
uses: GeyserMC/actions/setup-gradle-composite@master
19+
with:
20+
setup-java_java-version: 17
21+
22+
- name: Build EmoteOffhandExtension
23+
run: ./gradlew build
24+
25+
- name: Archive Artifacts
26+
uses: GeyserMC/actions/upload-multi-artifact@master
27+
if: success()
28+
with:
29+
artifacts: build/libs/EmoteOffhand.jar
30+
31+
- name: Get Version
32+
if: ${{ success() && github.repository == 'GeyserMC/EmoteOffhandExtension' && github.ref_name == 'master' }}
33+
id: get-version
34+
run: |
35+
version=$(cat build.gradle | grep -o "version '[0-9\\.]*'" | cut -d" " -f2 | sed "s/'//g")
36+
echo "VERSION=${version}" >> $GITHUB_OUTPUT
37+
38+
- name: Get Release Metadata
39+
if: ${{ success() && github.repository == 'GeyserMC/EmoteOffhandExtension' && github.ref_name == 'master' }}
40+
uses: GeyserMC/actions/release@master
41+
id: metadata
42+
with:
43+
appID: ${{ secrets.RELEASE_APP_ID }}
44+
appPrivateKey: ${{ secrets.RELEASE_APP_PK }}
45+
files: |
46+
emoteoffhand:build/libs/EmoteOffhand.jar
47+
releaseEnabled: false
48+
saveMetadata: true
49+
releaseProject: 'emoteoffhand'
50+
releaseVersion: ${{ steps.get-version.outputs.VERSION }}
51+
52+
- name: Publish to Downloads API
53+
if: ${{ success() && github.repository == 'GeyserMC/EmoteOffhandExtension' && github.ref_name == 'master' }}
54+
uses: GeyserMC/actions/upload-release@master
55+
with:
56+
username: ${{ vars.DOWNLOADS_USERNAME }}
57+
privateKey: ${{ secrets.DOWNLOADS_PRIVATE_KEY }}
58+
host: ${{ secrets.DOWNLOADS_SERVER_IP }}
59+
files: |
60+
build/libs/EmoteOffhand.jar
61+
changelog: ${{ steps.metadata.outputs.body }}
62+
63+
- name: Notify Discord
64+
if: ${{ (success() || failure()) && github.repository == 'GeyserMC/EmoteOffhandExtension' }}
65+
uses: GeyserMC/actions/notify-discord@master
66+
with:
67+
discordWebhook: ${{ secrets.DISCORD_WEBHOOK }}
68+
status: ${{ job.status }}
69+
body: ${{ steps.metadata.outputs.body }}

build.gradle.kts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,21 @@ plugins {
88
group = "org.geysermc.extension.emoteoffhand"
99
version = "1.0.0"
1010

11-
configurations {
12-
create("shadowBundle") {
13-
isCanBeResolved = true
14-
isCanBeConsumed = false
15-
isTransitive = false
16-
}
17-
}
18-
1911
repositories {
2012
mavenCentral()
2113
maven("https://repo.opencollab.dev/main")
2214
}
2315

24-
val shadowBundle = configurations.named("shadowBundle")
25-
2616
dependencies {
2717
compileOnly("org.geysermc.geyser:api:2.9.0-SNAPSHOT")
2818

2919
implementation("org.yaml:snakeyaml:2.5")
30-
shadowBundle("org.yaml:snakeyaml:2.5")
20+
shadow("org.yaml:snakeyaml:2.5")
3121
}
3222

3323
tasks {
3424
named<Jar>("jar") {
3525
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
36-
3726
archiveFileName.set("${project.name}-${project.version}-nonrelocated.jar")
3827

3928
from({
@@ -44,10 +33,8 @@ tasks {
4433
}
4534

4635
val shadowJar = named<ShadowJar>("shadowJar") {
47-
configurations = listOf(project.configurations.getByName("shadowBundle"))
48-
4936
archiveFileName.set("${project.name}.jar")
50-
37+
from(project.rootProject.file("LICENSE"))
5138
relocate("org.yaml.snakeyaml", "org.geysermc.extension.emoteoffhand.shadow.snakeyaml")
5239
}
5340

0 commit comments

Comments
 (0)