Skip to content

Commit 1c88aef

Browse files
committed
Merge branch 'main' into slash-commands-fix
Update to the latest main commit. Integrates with the new CorePlugin class, including a description.
2 parents dd5ae94 + ca0df6d commit 1c88aef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1660
-860
lines changed

.github/workflows/build-aliucord.yml

-62
This file was deleted.

.github/workflows/build-injector.yml

-49
This file was deleted.

.github/workflows/build-installer.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@ jobs:
2323
with:
2424
path: src
2525

26+
- name: Setup JDK 17
27+
uses: actions/setup-java@v4
28+
with:
29+
distribution: 'temurin'
30+
java-version: '17'
31+
2632
- name: Setup Flutter
27-
uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # v2.10.0
33+
uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2.16.0
2834
with:
29-
flutter-version: '3.10.6'
35+
flutter-version: '3.24.0'
3036

3137
- name: Build Installer
3238
run: |

.github/workflows/build.yml

+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- "**.md"
7+
pull_request:
8+
paths-ignore:
9+
- "**.md"
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-24.04
14+
timeout-minutes: 8
15+
# Prevent duplicate workflow run for PRs from same repo
16+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork }}
17+
permissions:
18+
contents: read
19+
steps:
20+
- name: Checkout src
21+
uses: actions/checkout@v4
22+
with:
23+
path: src
24+
persist-credentials: false
25+
26+
- name: Setup JDK 11
27+
uses: actions/setup-java@v4
28+
with:
29+
distribution: "zulu"
30+
java-version: "11"
31+
32+
- name: Setup Android SDK
33+
uses: android-actions/setup-android@v3
34+
with:
35+
cmdline-tools-version: 9862592 # 10.0 is the last version working with JDK 11
36+
37+
- name: Build project
38+
run: |
39+
cd $GITHUB_WORKSPACE/src
40+
41+
# Check if this should be marked as a release build
42+
export RELEASE=${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
43+
44+
chmod +x gradlew
45+
./gradlew --stacktrace :Aliucord:make :Injector:make :patches:package :patches:disassembleWithPatches :patches:test
46+
47+
- name: Upload build artifacts
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: build
51+
if-no-files-found: error
52+
path: |
53+
${{ github.workspace }}/src/Aliucord/build/Aliucord.zip
54+
${{ github.workspace }}/src/Injector/build/Injector.dex
55+
${{ github.workspace }}/src/patches/build/patches.zip
56+
57+
deploy:
58+
runs-on: ubuntu-24.04
59+
timeout-minutes: 3
60+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
61+
needs: [ build ]
62+
permissions:
63+
contents: write
64+
steps:
65+
- name: Checkout src
66+
uses: actions/checkout@v4
67+
with:
68+
path: src
69+
70+
- name: Checkout builds
71+
uses: actions/checkout@v4
72+
with:
73+
ref: builds
74+
path: builds
75+
76+
- name: Download build artifacts
77+
uses: actions/download-artifact@v4
78+
with:
79+
name: build
80+
path: artifacts
81+
82+
- name: Deploy builds
83+
if: github.ref == 'refs/heads/main'
84+
run: |
85+
# Flatten downloaded artifacts
86+
find $GITHUB_WORKSPACE/artifacts -type f -exec mv -t $GITHUB_WORKSPACE/artifacts '{}' +
87+
88+
# Legacy Installer support for now
89+
cp $GITHUB_WORKSPACE/src/.assets/AndroidManifest.xml $GITHUB_WORKSPACE/builds
90+
91+
# Extract component versions
92+
coreVersion=$(cat $GITHUB_WORKSPACE/src/Aliucord/build.gradle.kts | grep -E 'version = "' | cut -d \" -f 2)
93+
patchesVersion=$(cat $GITHUB_WORKSPACE/src/patches/build.gradle.kts | grep -E 'version = "' | cut -d \" -f 2)
94+
injectorVersion=$(cat $GITHUB_WORKSPACE/src/Injector/build.gradle.kts | grep -E 'version = "' | cut -d \" -f 2)
95+
96+
# Copy over builds if version changed
97+
cd $GITHUB_WORKSPACE/builds
98+
[ "$(jq -r '.coreVersion' data.json)" != "$coreVersion" ] && cp $GITHUB_WORKSPACE/artifacts/Aliucord.zip .
99+
[ "$(jq -r '.injectorVersion' data.json)" != "$injectorVersion" ] && cp $GITHUB_WORKSPACE/artifacts/Injector.dex .
100+
[ "$(jq -r '.patchesVersion' data.json)" != "$patchesVersion" ] && cp $GITHUB_WORKSPACE/artifacts/patches.zip .
101+
102+
# Write versions to data.json
103+
# `aliucordHash` is kept to force old builds to update
104+
jq '. + { coreVersion: $cv, injectorVersion: $iv, patchesVersion: $pv, aliucordHash: "0000000" }' \
105+
--arg cv $coreVersion \
106+
--arg iv $injectorVersion \
107+
--arg pv $patchesVersion \
108+
../src/.assets/data.json > data.json
109+
110+
git config --local user.email "[email protected]"
111+
git config --local user.name "GitHub Actions"
112+
git add .
113+
if [[ `git status --porcelain` ]]; then
114+
git commit -m "Build $GITHUB_SHA"
115+
git push
116+
fi
117+
118+
# Publish core to maven if not originating from a PR
119+
maven:
120+
runs-on: ubuntu-24.04
121+
timeout-minutes: 5
122+
if: github.event_name != 'pull_request'
123+
needs: [ build ]
124+
permissions:
125+
contents: read
126+
env:
127+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
128+
steps:
129+
- name: Checkout src
130+
if: ${{ env.MAVEN_USERNAME != '' }}
131+
uses: actions/checkout@v4
132+
with:
133+
path: src
134+
persist-credentials: false
135+
136+
- name: Setup JDK 11
137+
if: ${{ env.MAVEN_USERNAME != '' }}
138+
uses: actions/setup-java@v4
139+
with:
140+
distribution: "zulu"
141+
java-version: "11"
142+
143+
- name: Build & Publish to Maven
144+
if: ${{ env.MAVEN_USERNAME != '' }}
145+
run: |
146+
cd $GITHUB_WORKSPACE/src
147+
chmod +x gradlew
148+
./gradlew :Aliucord:publish --stacktrace -Pversion=$GITHUB_REF_NAME-SNAPSHOT
149+
./gradlew :Aliucord:publish --stacktrace -Pversion=$(git rev-parse --short "$GITHUB_SHA") | exit 0
150+
env:
151+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

.github/workflows/publish-aliucord.yml

-28
This file was deleted.

.github/workflows/upload-pr-artifact.yml

-38
This file was deleted.

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ local.properties
1111
*.classpath
1212
*.project
1313
*org.eclipse.buildship.core.prefs
14-
.vscode
14+
.vscode
15+
/patches/smali/

Aliucord/build.gradle.kts

+3-11
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,17 @@ plugins {
55
id("org.jetbrains.dokka")
66
}
77

8-
fun getGitHash(): String {
9-
val stdout = org.apache.commons.io.output.ByteArrayOutputStream()
10-
exec {
11-
commandLine = listOf("git", "rev-parse", "--short", "HEAD")
12-
standardOutput = stdout
13-
isIgnoreExitValue = true
14-
}
15-
return stdout.toString().trim()
16-
}
17-
188
group = "com.aliucord"
9+
version = "2.0.1"
1910

2011
aliucord {
2112
projectType.set(com.aliucord.gradle.ProjectType.CORE)
2213
}
2314

2415
android {
2516
defaultConfig {
26-
buildConfigField("String", "GIT_REVISION", "\"${getGitHash()}\"")
17+
buildConfigField("String", "VERSION", "\"$version\"")
18+
buildConfigField("boolean", "RELEASE", System.getenv("RELEASE") ?: "false")
2719
buildConfigField("int", "DISCORD_VERSION", libs.versions.discord.get())
2820
}
2921

0 commit comments

Comments
 (0)