Skip to content

Commit 6522c3f

Browse files
authored
Deploy master branch commits as snapshot (#1983)
* Deploy main branch commits as snapshot * Snapshot builds don't have a Release artifact * restrict snapshot to actual commits on master branch * Deploy steps don't actually use test-run maven artifacts * Partial Revert. We need that artifact
1 parent 44a50de commit 6522c3f

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed

.github/workflows/main.yml

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ jobs:
206206
# The snapshot is downloaded when people build the engine without setting buildNativeProject
207207
# this is useful for people that want to build only the java part and don't have
208208
# all the stuff needed to compile natives.
209-
DeploySnapshot:
209+
DeployNativeSnapshot:
210210
needs: [BuildJMonkey]
211-
name: "Deploy snapshot"
211+
name: "Deploy native snapshot"
212212
runs-on: ubuntu-latest
213213
if: github.event_name == 'push'
214214
steps:
@@ -291,6 +291,50 @@ jobs:
291291
fi
292292
fi
293293
294+
# This job deploys snapshots on the master branch
295+
DeployJavaSnapshot:
296+
needs: [BuildJMonkey]
297+
name: Deploy Java Snapshot
298+
runs-on: ubuntu-latest
299+
if: github.event_name == 'push' && github.ref_name == 'master'
300+
steps:
301+
302+
# We need to clone everything again for uploadToMaven.sh ...
303+
- name: Clone the repo
304+
uses: actions/checkout@v3
305+
with:
306+
fetch-depth: 1
307+
308+
# Setup jdk 17 used for building Maven-style artifacts
309+
- name: Setup the java environment
310+
uses: actions/setup-java@v3
311+
with:
312+
distribution: 'temurin'
313+
java-version: '17'
314+
315+
- name: Download natives for android
316+
uses: actions/download-artifact@master
317+
with:
318+
name: android-natives
319+
path: build/native
320+
321+
- name: Rebuild the maven artifacts and deploy them to the Sonatype repository
322+
run: |
323+
if [ "${{ secrets.OSSRH_PASSWORD }}" = "" ];
324+
then
325+
echo "Configure the following secrets to enable deployment to Sonatype:"
326+
echo "OSSRH_PASSWORD, OSSRH_USERNAME, SIGNING_KEY, SIGNING_PASSWORD"
327+
else
328+
./gradlew publishMavenPublicationToSNAPSHOTRepository \
329+
-PossrhPassword=${{ secrets.OSSRH_PASSWORD }} \
330+
-PossrhUsername=${{ secrets.OSSRH_USERNAME }} \
331+
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
332+
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
333+
-PuseCommitHashAsVersionName=true \
334+
--console=plain --stacktrace
335+
fi
336+
337+
294338
# This job deploys the release
295339
DeployRelease:
296340
needs: [BuildJMonkey]

common.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ publishing {
171171
name = 'OSSRH'
172172
url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2'
173173
}
174+
maven {
175+
credentials {
176+
username = gradle.rootProject.hasProperty('ossrhUsername') ? ossrhUsername : 'Unknown user'
177+
password = gradle.rootProject.hasProperty('ossrhPassword') ? ossrhPassword : 'Unknown password'
178+
}
179+
name = 'SNAPSHOT'
180+
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
181+
}
174182
}
175183
}
176184

0 commit comments

Comments
 (0)