Skip to content

Commit 5620a21

Browse files
committed
chore: 🔧 update build process
1 parent c2fe5b4 commit 5620a21

File tree

3 files changed

+15
-106
lines changed

3 files changed

+15
-106
lines changed

‎.github/workflows/gradle.yml‎

Lines changed: 4 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -3,100 +3,9 @@ name: Mod Build
33
on: [ workflow_dispatch, push ]
44

55
jobs:
6-
build:
7-
runs-on: ubuntu-latest
6+
mod_build:
87
permissions:
8+
contents: read
99
packages: write
10-
11-
steps:
12-
- uses: actions/checkout@v4
13-
with:
14-
fetch-depth: 200
15-
- name: Set up JDK 21
16-
uses: actions/setup-java@v4
17-
with:
18-
java-version: 21
19-
distribution: zulu
20-
cache: gradle
21-
- name: Build with Gradle
22-
env:
23-
USERNAME: ${{ secrets.USERNAME }}
24-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25-
uses: nick-invision/retry@v3
26-
with:
27-
timeout_minutes: 10
28-
max_attempts: 3
29-
command: ./gradlew build
30-
- name: Publish to Github Packages
31-
env:
32-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33-
run: ./gradlew build publish
34-
- name: Cleanup old artifacts
35-
uses: actions/delete-package-versions@v5
36-
with:
37-
package-name: 'sophisticatedstorageinmotion.sophisticatedstorageinmotion'
38-
package-type: 'maven'
39-
min-versions-to-keep: 10
40-
continue-on-error: true
41-
- name: Publish to CurseForge
42-
env:
43-
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
44-
run: |
45-
BRANCH_NAME=${GITHUB_REF##*/}
46-
if [[ "$BRANCH_NAME" =~ ^[0-9]+\.[0-9]+\.([0-9]+|x)$ ]]; then
47-
./gradlew curseforge
48-
else
49-
echo "Branch name does not match the pattern: $BRANCH_NAME. Skipping CurseForge upload."
50-
exit 0
51-
fi
52-
- name: Publish to Modrinth
53-
env:
54-
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
55-
run: |
56-
BRANCH_NAME=${GITHUB_REF##*/}
57-
if [[ "$BRANCH_NAME" =~ ^[0-9]+\.[0-9]+\.([0-9]+|x)$ ]]; then
58-
./gradlew modrinth
59-
else
60-
echo "Branch name does not match the pattern: $BRANCH_NAME. Skipping Modrinth upload."
61-
exit 0
62-
fi
63-
- name: Code Quality
64-
env:
65-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66-
run: ./gradlew -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.organization=p3pp3rf1y-github sonarqube
67-
- name : Retrieve Version
68-
run: |
69-
echo "$(${{github.workspace}}/gradlew -q printVersionName | awk -F "version:" '{printf $2}')"
70-
echo "VERSION_NAME=$(${{github.workspace}}/gradlew -q printVersionName | awk -F "version:" '{printf $2}')" >> $GITHUB_OUTPUT
71-
id: version
72-
- name : Compile version message
73-
uses: actions/github-script@v7
74-
with:
75-
script: |
76-
const gh = ${{ toJSON(github) }};
77-
78-
core.setOutput('EMBED_TITLE', "[" + gh.event.repository.name + ":" + gh.ref_name +"] new build ${{steps.version.outputs.VERSION_NAME}}");
79-
core.setOutput('EMBED_URL', "https://github.com/P3pp3rF1y/SophisticatedStorage/packages/1388832?version=${{steps.version.outputs.VERSION_NAME}}");
80-
core.setOutput('EMBED_AUTHOR_NAME', gh.event.sender.login);
81-
core.setOutput('EMBED_AUTHOR_ICON_URL', gh.event.sender.avatar_url);
82-
83-
const commits = ${{ toJSON(github.event.commits) }};
84-
let description = "";
85-
for (const commit of commits) {
86-
if (description.length !== 0) {
87-
description += "\n";
88-
}
89-
description += "[" + commit.id.slice(0,7) + "](<" + commit.url + ">) " + commit.message + " - " + commit.author.username;
90-
}
91-
core.setOutput('EMBED_DESCRIPTION', description);
92-
id: embed
93-
- name: Send Discord Notification
94-
uses: tsickert/discord-webhook@v6.0.0
95-
with:
96-
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
97-
embed-title: "${{steps.embed.outputs.EMBED_TITLE}}"
98-
embed-url: "${{steps.embed.outputs.EMBED_URL}}"
99-
embed-description: "${{steps.embed.outputs.EMBED_DESCRIPTION}}"
100-
embed-author-name: "${{steps.embed.outputs.EMBED_AUTHOR_NAME}}"
101-
embed-author-icon-url: "${{steps.embed.outputs.EMBED_AUTHOR_ICON_URL}}"
102-
embed-color: 58633
10+
uses: P3pp3rF1y/MultiWorkspace/.github/workflows/mod-build-template.yml@1.21.x
11+
secrets: inherit

‎build.gradle‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,22 @@ repositories {
3737
name = "GHPCore"
3838
url = uri("https://maven.pkg.github.com/p3pp3rf1y/sophisticatedcore")
3939
credentials {
40-
username = System.getenv("USERNAME")
40+
username = System.getenv("GITHUB_ACTOR")
4141
password = System.getenv("GITHUB_TOKEN")
4242
}
4343
content {
44-
includeGroupByRegex "sophisticatedcore.*"
44+
includeModule("net.p3pp3rf1y", "sophisticatedcore")
4545
}
4646
}
4747
maven {
4848
name = "GHPStorage"
4949
url = uri("https://maven.pkg.github.com/p3pp3rf1y/sophisticatedstorage")
5050
credentials {
51-
username = System.getenv("USERNAME")
51+
username = System.getenv("GITHUB_ACTOR")
5252
password = System.getenv("GITHUB_TOKEN")
5353
}
5454
content {
55-
includeGroupByRegex "sophisticatedstorage.*"
55+
includeModule("net.p3pp3rf1y", "sophisticatedstorage")
5656
}
5757
}
5858
maven {
@@ -165,20 +165,20 @@ dependencies {
165165
if (findProject(':SophisticatedCore') != null) {
166166
dependencies.implementation project(':SophisticatedCore')
167167
} else {
168-
dependencies.implementation("sophisticatedcore:sophisticatedcore:${sc_version}") {
168+
dependencies.implementation("net.p3pp3rf1y:sophisticatedcore:${sc_version}") {
169169
transitive = false
170170
}
171-
dependencies.testImplementation("sophisticatedcore:sophisticatedcore:${sc_version}") {
171+
dependencies.testImplementation("net.p3pp3rf1y:sophisticatedcore:${sc_version}") {
172172
transitive = false
173173
}
174174
}
175175
if (findProject(':SophisticatedStorage') != null) {
176176
dependencies.implementation project(':SophisticatedStorage')
177177
} else {
178-
dependencies.implementation("sophisticatedstorage:sophisticatedstorage:${ss_version}") {
178+
dependencies.implementation("net.p3pp3rf1y:sophisticatedstorage:${ss_version}") {
179179
transitive = false
180180
}
181-
dependencies.testImplementation("sophisticatedstorage:sophisticatedstorage:${ss_version}") {
181+
dependencies.testImplementation("net.p3pp3rf1y:sophisticatedstorage:${ss_version}") {
182182
transitive = false
183183
}
184184
}
@@ -266,9 +266,9 @@ publishing {
266266
}
267267
}
268268

269-
sonarqube {
269+
sonar {
270270
properties {
271-
property "sonar.projectName", "${mod_id}"
271+
property "sonar.organization", "p3pp3rf1y-github"
272272
property "sonar.projectKey", "${sonar_project_key}"
273273
}
274274
}

‎gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ mod_id=sophisticatedstorageinmotion
1414
mod_name=Sophisticated Storage In Motion
1515
mod_license=All Rights Reserved
1616
mod_version=0.10.25
17-
mod_group_id=sophisticatedstorageinmotion
17+
mod_group_id=net.p3pp3rf1y
1818
mod_authors=P3pp3rF1y
1919
mod_description=Sophisticated Storage on moving entities.
2020
mod_credits=Created by P3pp3rF1y.

0 commit comments

Comments
 (0)