Skip to content

Commit 5c356ab

Browse files
authored
Merge pull request #9 from litetex-oss/dev
Release
2 parents efffeb2 + 400f2ac commit 5c356ab

File tree

12 files changed

+271
-49
lines changed

12 files changed

+271
-49
lines changed

.github/workflows/check-build.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ on:
2424
jobs:
2525
build:
2626
runs-on: ubuntu-latest
27-
27+
timeout-minutes: 10
2828
strategy:
2929
matrix:
3030
java: [21]
@@ -41,7 +41,7 @@ jobs:
4141
cache: 'gradle'
4242

4343
- name: Build
44-
run: ./gradlew build --info
44+
run: ./gradlew build --info --stacktrace
4545

4646
- name: Check for uncommited changes
4747
run: |
@@ -65,13 +65,17 @@ jobs:
6565
uses: actions/upload-artifact@v4
6666
with:
6767
name: mod-files-java-${{ matrix.java }}
68-
path: build/libs/*.jar
68+
path: |
69+
build/devlibs/*-sources.jar
70+
build/libs/*.jar
71+
!build/libs/*-sources.jar
72+
!build/libs/*-javadoc.jar
6973
if-no-files-found: error
7074

7175
code-style:
7276
runs-on: ubuntu-latest
7377
if: ${{ github.event_name != 'pull_request' || !(startsWith(github.head_ref, 'renovate/') || startsWith(github.head_ref, 'automated/')) }}
74-
78+
timeout-minutes: 10
7579
strategy:
7680
matrix:
7781
java: [21]

.github/workflows/release.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ permissions:
99
pull-requests: write
1010

1111
jobs:
12-
check_code: # Validates the code
12+
check_code:
1313
runs-on: ubuntu-latest
14+
timeout-minutes: 10
1415
steps:
1516
- uses: actions/checkout@v4
1617

@@ -45,6 +46,7 @@ jobs:
4546
prepare_release:
4647
runs-on: ubuntu-latest
4748
needs: [check_code]
49+
timeout-minutes: 10
4850
outputs:
4951
upload_url: ${{ steps.create_release.outputs.upload_url }}
5052
steps:
@@ -98,11 +100,12 @@ jobs:
98100
## Installation
99101
The mod can be downloaded from [Modrinth](https://modrinth.com/mod/${{ steps.metadata.outputs.archives_base_name }}).
100102
101-
Alternatively you can also download the mod from the release assets below.
103+
Alternatively you can also download the mod from the release assets below or from [Maven Central](https://repo.maven.apache.org/maven2/net/litetex/mcm/).
102104
103105
publish:
104106
runs-on: ubuntu-latest
105107
needs: [prepare_release]
108+
timeout-minutes: 60
106109
steps:
107110
- uses: actions/checkout@v4
108111

@@ -120,7 +123,7 @@ jobs:
120123
git pull
121124
122125
- name: Build and publish
123-
run: ./gradlew clean build modrinth --info
126+
run: ./gradlew clean build modrinth --info --stacktrace
124127
env:
125128
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
126129
MODRINTH_CHANGELOG_TEXT: 'Available at https://github.com/litetex-oss/mcm-cape-provider/blob/dev/CHANGELOG.md'
@@ -129,11 +132,24 @@ jobs:
129132
uses: shogo82148/actions-upload-release-asset@v1
130133
with:
131134
upload_url: ${{ needs.prepare_release.outputs.upload_url }}
132-
asset_path: build/libs/*.jar
135+
asset_path: |
136+
build/devlibs/*-sources.jar
137+
build/libs/*.jar
138+
!build/libs/*-sources.jar
139+
!build/libs/*-javadoc.jar
140+
141+
- name: Publish to OSSRH
142+
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --info --stacktrace
143+
env:
144+
MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
145+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
146+
S01_OSS_SONATYPE_MAVEN_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }}
147+
S01_OSS_SONATYPE_MAVEN_TOKEN: ${{ secrets.S01_OSS_SONATYPE_MAVEN_TOKEN }}
133148

134149
after_release:
135150
runs-on: ubuntu-latest
136151
needs: [publish]
152+
timeout-minutes: 10
137153
steps:
138154
- uses: actions/checkout@v4
139155

.github/workflows/sonar.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
name: SonarCloud Scan
3131
runs-on: ubuntu-latest
3232
if: ${{ github.event_name != 'pull_request' || !(startsWith(github.head_ref, 'renovate/') || startsWith(github.head_ref, 'automated/')) }}
33+
timeout-minutes: 15
3334
steps:
3435
- uses: actions/checkout@v4
3536
with:

.github/workflows/test-deploy.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
jobs:
77
publish:
88
runs-on: ubuntu-latest
9+
timeout-minutes: 60
910
steps:
1011
- uses: actions/checkout@v4
1112

@@ -15,9 +16,9 @@ jobs:
1516
distribution: 'temurin'
1617
java-version: '21'
1718
cache: 'gradle'
18-
19+
1920
- name: Build and publish
20-
run: ./gradlew clean build modrinth --info
21+
run: ./gradlew clean build modrinth --info --stacktrace
2122
env:
2223
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
2324
MODRINTH_VERSION_TYPE: 'alpha'
@@ -27,5 +28,17 @@ jobs:
2728
uses: actions/upload-artifact@v4
2829
with:
2930
name: mod-files
30-
path: build/libs/*.jar
31+
path: |
32+
build/devlibs/*-sources.jar
33+
build/libs/*.jar
34+
!build/libs/*-sources.jar
35+
!build/libs/*-javadoc.jar
3136
if-no-files-found: error
37+
38+
- name: Publish to OSSRH
39+
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --info --stacktrace
40+
env:
41+
MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
42+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
43+
S01_OSS_SONATYPE_MAVEN_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }}
44+
S01_OSS_SONATYPE_MAVEN_TOKEN: ${{ secrets.S01_OSS_SONATYPE_MAVEN_TOKEN }}

.github/workflows/update-yarn.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515
jobs:
1616
update:
1717
runs-on: ubuntu-latest
18-
18+
timeout-minutes: 10
1919
steps:
2020
- uses: actions/checkout@v4
2121
with:

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 1.0.2
2+
* Distribute mod on Maven Central
3+
14
# 1.0.1
25
* Improved compatibility information
36

PROGRAMMATIC_PROVIDER.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Creating a custom programmatic cape provider
2+
3+
> [!NOTE]
4+
> This is more complex and some Java coding experience is required.
5+
6+
You can also add a custom cape provider programmatically using [Java's Service Loading](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/ServiceLoader.html).
7+
8+
To achieve the same as in the example [from the Readme](./README.md) do the following:
9+
10+
1. Create a new (fabric) mod
11+
2. Add the mod as a dependency:
12+
``build.gradle``
13+
```groovy
14+
dependencies {
15+
modImplementation 'net.litetex.mcm:cape-provider:<version>'
16+
}
17+
```
18+
3. Create a custom provider:
19+
``src/main/java/com/example/capes/provider/MyCustomCapeProvider.java``
20+
```java
21+
public class MyCustomCapeProvider implements CapeProvider
22+
{
23+
@Override
24+
public String id() {
25+
return "cp";
26+
}
27+
28+
@Override
29+
public String name() {
30+
return "Custom Provider";
31+
}
32+
33+
@Override
34+
public String getBaseUrl(GameProfile profile) {
35+
return "https://raw.githubusercontent.com/litetex-oss/mcm-cape-provider/refs/heads/dev/custom-cape-demo/uuid.png";
36+
}
37+
38+
// You can add more custom code here
39+
}
40+
```
41+
4. Register the provider
42+
``src/main/resources/META-INF/services/net.litetex.capes.provider.CapeProvider``
43+
```
44+
com.example.capes.provider.MyCustomCapeProvider
45+
```
46+
5. (Optional) Declare that your mod needs Cape Provider
47+
``src/main/resources/fabric.mod.json``
48+
```jsonc
49+
// ...
50+
"recommends": { // You can also use "depends"
51+
"cape-provider": "*" // Or add the corresponding version
52+
}
53+
// ...
54+
```
55+
You might also have to declare this in other places (e.g. on Modrinth).

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,27 @@ This demo showcases how to apply the capes inside [``custom-cape-demo``](https:/
4141

4242
For more details have a look at [CustomProvider](https://github.com/litetex-oss/mcm-cape-provider/tree/dev/src/main/java/net/litetex/capes/provider/CustomProvider.java) and [CustomProviderConfig](https://github.com/litetex-oss/mcm-cape-provider/tree/dev/src/main/java/net/litetex/capes/config/CustomProviderConfig.java)
4343

44+
You can also create a [programmatic cape provider](https://github.com/litetex-oss/mcm-cape-provider/tree/dev/PROGRAMMATIC_PROVIDER.md).
45+
4446
<!-- modrinth_exclude.start -->
4547

4648
## Installation
4749
[Installation guide for the latest release](https://github.com/litetex-oss/mcm-cape-provider/releases/latest#Installation)
4850

51+
### Usage in other mods
52+
53+
Add the following to ``build.gradle``:
54+
```groovy
55+
dependencies {
56+
modImplementation 'net.litetex.mcm:cape-provider:<version>'
57+
// Further documentation: https://wiki.fabricmc.net/documentation:fabric_loom
58+
}
59+
```
60+
61+
> [!NOTE]
62+
> No dedicated repository is required as the content are hosted on [Maven Central](https://maven.apache.org/repository/).<br/>
63+
> If this somehow shouldn't work you can also try [Modrinth Maven](https://support.modrinth.com/en/articles/8801191-modrinth-maven).
64+
4965
## Contributing
5066
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.
5167

0 commit comments

Comments
 (0)