Skip to content

Commit 1c0bf57

Browse files
committed
Feat(Experiment-3): GitHub Action Build/Publish.
1 parent 7b21376 commit 1c0bf57

4 files changed

Lines changed: 96 additions & 12 deletions

File tree

.github/workflows/remotelymod-cloud.yml

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,54 @@ jobs:
4545
path: Remotely
4646
ref: ${{ inputs.remotely_ref != '' && inputs.remotely_ref || github.ref }}
4747

48+
- name: Load sibling repository pins
49+
working-directory: Remotely
50+
run: |
51+
set -a
52+
source ci/sibling-pins.env
53+
set +a
54+
echo "RESCREEN_REF=${RESCREEN_REF}" >> "$GITHUB_ENV"
55+
echo "REMODEL_REF=${REMODEL_REF}" >> "$GITHUB_ENV"
56+
echo "REBASE_REF=${REBASE_REF}" >> "$GITHUB_ENV"
57+
4858
- name: Checkout ReScreen
4959
uses: actions/checkout@v4
5060
with:
5161
repository: RedxAx/ReScreen
5262
token: ${{ secrets.REPROJECTS_PAT }}
5363
path: ReScreen
64+
ref: ${{ env.RESCREEN_REF }}
5465

5566
- name: Checkout Remodel
5667
uses: actions/checkout@v4
5768
with:
5869
repository: RedxAx/Remodel
5970
token: ${{ secrets.REPROJECTS_PAT }}
6071
path: Remodel
72+
ref: ${{ env.REMODEL_REF }}
6173

6274
- name: Checkout Rebase
6375
uses: actions/checkout@v4
6476
with:
6577
repository: RedxAx/Rebase
6678
token: ${{ secrets.REPROJECTS_PAT }}
6779
path: Rebase
80+
ref: ${{ env.REBASE_REF }}
81+
82+
- name: Ensure Remodel Java 21 toolchain
83+
run: |
84+
chmod +x Remotely/RemotelyMod/scripts/ci-ensure-remodel-java21.sh
85+
Remotely/RemotelyMod/scripts/ci-ensure-remodel-java21.sh Remodel
6886
69-
- name: Set up JDK 21
87+
- name: Set up JDK 21 and 25
7088
uses: actions/setup-java@v4
7189
with:
7290
distribution: temurin
73-
java-version: '21'
91+
java-version: '21,25'
7492
cache: gradle
93+
cache-dependency-path: |
94+
Remotely/gradle/wrapper/gradle-wrapper.properties
95+
Remotely/RemotelyMod/gradle/wrapper/gradle-wrapper.properties
7596
7697
- name: Preflight Remotely App jar
7798
working-directory: Remotely
@@ -82,24 +103,24 @@ jobs:
82103
- name: Ensure version project directories
83104
working-directory: Remotely/RemotelyMod
84105
run: |
85-
chmod +x scripts/ensure-version-project-dirs.sh
106+
chmod +x scripts/ensure-version-project-dirs.sh scripts/ci-verify-version-layout.sh
86107
./scripts/ensure-version-project-dirs.sh
108+
./scripts/ci-verify-version-layout.sh
87109
88-
- name: Build all RemotelyMod versions
89-
working-directory: Remotely/RemotelyMod
90-
run: |
91-
chmod +x gradlew
92-
./gradlew buildAllVersions --no-daemon --stacktrace
93-
94-
- name: Publish RemotelyMod
95-
if: startsWith(inputs.goal, 'publish')
110+
- name: Run RemotelyMod Gradle goal
96111
working-directory: Remotely/RemotelyMod
97112
env:
98113
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
99114
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
100115
run: |
101116
chmod +x gradlew
102-
./gradlew ${{ inputs.goal }} --no-daemon --stacktrace
117+
if [[ "${{ inputs.goal }}" == buildAllVersions ]]; then
118+
./gradlew buildAllVersions --no-daemon --stacktrace
119+
elif [[ "${{ inputs.goal }}" == publish* ]]; then
120+
./gradlew buildAllVersions "${{ inputs.goal }}" --no-daemon --stacktrace
121+
else
122+
./gradlew "${{ inputs.goal }}" --no-daemon --stacktrace
123+
fi
103124
104125
- name: Upload mod jars
105126
uses: actions/upload-artifact@v4
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
remodel_root="${1:?Remodel directory path required}"
4+
build_file="$remodel_root/build.gradle"
5+
if [[ ! -f "$build_file" ]]; then
6+
echo "::error::Remodel build.gradle not found at $build_file"
7+
exit 1
8+
fi
9+
if grep -q 'JavaLanguageVersion.of(21)' "$build_file"; then
10+
exit 0
11+
fi
12+
if ! grep -q '^test {' "$build_file"; then
13+
echo "::error::Remodel build.gradle has no test { block; cannot inject Java 21 toolchain"
14+
exit 1
15+
fi
16+
tmp="$(mktemp)"
17+
awk '
18+
/^test \{/ && !done {
19+
print "java {"
20+
print " toolchain {"
21+
print " languageVersion = JavaLanguageVersion.of(21)"
22+
print " }"
23+
print "}"
24+
print ""
25+
done = 1
26+
}
27+
{ print }
28+
' "$build_file" > "$tmp"
29+
mv "$tmp" "$build_file"
30+
echo "Injected Java 21 toolchain into Remodel build.gradle for CI compatibility"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
root="$(cd "$(dirname "$0")/.." && pwd)"
4+
cd "$root"
5+
missing=0
6+
while IFS= read -r version; do
7+
dir="versions/$version"
8+
if [[ ! -d "$dir" ]]; then
9+
echo "::error::Missing version directory $dir"
10+
missing=1
11+
continue
12+
fi
13+
if [[ "$version" == *-neoforge ]]; then
14+
props="$dir/gradle.properties"
15+
if [[ ! -f "$props" ]] || ! grep -q '^dgt\.neoforge\.version=' "$props"; then
16+
echo "::error::NeoForge version $version requires dgt.neoforge.version in $props"
17+
missing=1
18+
fi
19+
fi
20+
if [[ "$version" == "26.1.2-fabric" ]]; then
21+
props="$dir/gradle.properties"
22+
if [[ ! -f "$props" ]] || ! grep -q '^dgt\.fabric\.api\.version=' "$props"; then
23+
echo "::error::26.1.2-fabric requires dgt.fabric.api.version in $props"
24+
missing=1
25+
fi
26+
fi
27+
done < <(grep -E '^\s+"[0-9]' "$root/settings.gradle.kts" | sed -E 's/^[[:space:]]*"([^"]+)".*/\1/')
28+
if [[ "$missing" -ne 0 ]]; then
29+
exit 1
30+
fi

ci/sibling-pins.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
RESCREEN_REF=master
2+
REMODEL_REF=master
3+
REBASE_REF=master

0 commit comments

Comments
 (0)