Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy master branch commits as snapshot #1983

Merged
merged 5 commits into from Mar 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 46 additions & 2 deletions .github/workflows/main.yml
Expand Up @@ -206,9 +206,9 @@ jobs:
# The snapshot is downloaded when people build the engine without setting buildNativeProject
# this is useful for people that want to build only the java part and don't have
# all the stuff needed to compile natives.
DeploySnapshot:
DeployNativeSnapshot:
needs: [BuildJMonkey]
name: "Deploy snapshot"
name: "Deploy native snapshot"
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
Expand Down Expand Up @@ -291,6 +291,50 @@ jobs:
fi
fi

# This job deploys snapshots on the master branch
DeployJavaSnapshot:
needs: [BuildJMonkey]
name: Deploy Java Snapshot
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref_name == 'master'
steps:

# We need to clone everything again for uploadToMaven.sh ...
- name: Clone the repo
uses: actions/checkout@v3
with:
fetch-depth: 1

# Setup jdk 17 used for building Maven-style artifacts
- name: Setup the java environment
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Download natives for android
uses: actions/download-artifact@master
with:
name: android-natives
path: build/native

- name: Rebuild the maven artifacts and deploy them to the Sonatype repository
run: |
if [ "${{ secrets.OSSRH_PASSWORD }}" = "" ];
then
echo "Configure the following secrets to enable deployment to Sonatype:"
echo "OSSRH_PASSWORD, OSSRH_USERNAME, SIGNING_KEY, SIGNING_PASSWORD"
else
./gradlew publishMavenPublicationToSNAPSHOTRepository \
-PossrhPassword=${{ secrets.OSSRH_PASSWORD }} \
-PossrhUsername=${{ secrets.OSSRH_USERNAME }} \
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
-PuseCommitHashAsVersionName=true \
--console=plain --stacktrace
fi


# This job deploys the release
DeployRelease:
needs: [BuildJMonkey]
Expand Down
8 changes: 8 additions & 0 deletions common.gradle
Expand Up @@ -171,6 +171,14 @@ publishing {
name = 'OSSRH'
url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2'
}
maven {
credentials {
username = gradle.rootProject.hasProperty('ossrhUsername') ? ossrhUsername : 'Unknown user'
password = gradle.rootProject.hasProperty('ossrhPassword') ? ossrhPassword : 'Unknown password'
}
name = 'SNAPSHOT'
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
}

Expand Down