Skip to content

Commit 90177e6

Browse files
committed
chore: 🔧 update build process
1 parent d8591c0 commit 90177e6

File tree

3 files changed

+16
-107
lines changed

3 files changed

+16
-107
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 17
16-
uses: actions/setup-java@v4
17-
with:
18-
java-version: 17
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.20.x
11+
secrets: inherit

‎build.gradle‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id 'idea'
3-
id "org.sonarqube" version "4.3.1.3277"
3+
id "org.sonarqube" version "5.0.0.4638"
44
id "maven-publish"
55
id 'net.neoforged.gradle' version '[6.0.18,6.2)'
66
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
@@ -38,22 +38,22 @@ repositories {
3838
name = "GHPCore"
3939
url = uri("https://maven.pkg.github.com/p3pp3rf1y/sophisticatedcore")
4040
credentials {
41-
username = System.getenv("USERNAME")
41+
username = System.getenv("GITHUB_ACTOR")
4242
password = System.getenv("GITHUB_TOKEN")
4343
}
4444
content {
45-
includeGroupByRegex "sophisticatedcore.*"
45+
includeModule("net.p3pp3rf1y", "sophisticatedcore")
4646
}
4747
}
4848
maven {
4949
name = "GHPStorage"
5050
url = uri("https://maven.pkg.github.com/p3pp3rf1y/sophisticatedstorage")
5151
credentials {
52-
username = System.getenv("USERNAME")
52+
username = System.getenv("GITHUB_ACTOR")
5353
password = System.getenv("GITHUB_TOKEN")
5454
}
5555
content {
56-
includeGroupByRegex "sophisticatedstorage.*"
56+
includeModule("net.p3pp3rf1y", "sophisticatedstorage")
5757
}
5858
}
5959
maven {
@@ -144,21 +144,21 @@ dependencies {
144144
implementation project(':SophisticatedCore')
145145
testImplementation project(':SophisticatedCore')
146146
} else {
147-
implementation fg.deobf("sophisticatedcore:sophisticatedcore:${sc_version}") {
147+
implementation fg.deobf("net.p3pp3rf1y:sophisticatedcore:${sc_version}") {
148148
transitive = false
149149
}
150-
testImplementation fg.deobf("sophisticatedcore:sophisticatedcore:${sc_version}") {
150+
testImplementation fg.deobf("net.p3pp3rf1y:sophisticatedcore:${sc_version}") {
151151
transitive = false
152152
}
153153
}
154154
if (findProject(':SophisticatedStorage') != null) {
155155
implementation project(':SophisticatedStorage')
156156
testImplementation project(':SophisticatedStorage')
157157
} else {
158-
implementation fg.deobf("sophisticatedstorage:sophisticatedstorage:${ss_version}") {
158+
implementation fg.deobf("net.p3pp3rf1y:sophisticatedstorage:${ss_version}") {
159159
transitive = false
160160
}
161-
testImplementation fg.deobf("sophisticatedstorage:sophisticatedstorage:${ss_version}") {
161+
testImplementation fg.deobf("net.p3pp3rf1y:sophisticatedstorage:${ss_version}") {
162162
transitive = false
163163
}
164164
}
@@ -235,9 +235,9 @@ publishing {
235235
}
236236
}
237237

238-
sonarqube {
238+
sonar {
239239
properties {
240-
property "sonar.projectName", "${mod_id}"
240+
property "sonar.organization", "p3pp3rf1y-github"
241241
property "sonar.projectKey", "${sonar_project_key}"
242242
}
243243
}

‎gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx3G
22
org.gradle.daemon=false
33

44
mod_id=sophisticatedstorageinmotion
5-
mod_group_id=sophisticatedstorageinmotion
5+
mod_group_id=net.p3pp3rf1y
66
mod_version=0.10.27
77
sonar_project_key=sophisticatedstorageinmotion:SophisticatedStorageInMotion
88
github_package_url=https://maven.pkg.github.com/P3pp3rF1y/SophisticatedStorageInMotion

0 commit comments

Comments
 (0)