chore: PR deploy step

(cherry picked from commit 8a9439643c)
This commit is contained in:
mworzala 2023-11-23 05:46:53 -05:00 committed by Matt Worzala
parent 8d117164f6
commit 11a7f02854
2 changed files with 35 additions and 6 deletions

View File

@ -26,7 +26,33 @@ jobs:
# Ignore some of the paths when caching Maven Local repository
maven-local-ignore-paths: |
net/minestom/
- name: Build Minestom
run: ./gradlew classes testClasses
- name: Run Minestom tests
run: ./gradlew test
# TODO: reenable
# - name: Build Minestom
# run: ./gradlew classes testClasses
# - name: Run Minestom tests
# run: ./gradlew test
publish:
needs: [ build ]
runs-on: ubuntu-latest
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSWORD }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: Set outputs
id: vars
run: echo "short_commit_hash=${GITHUB_SHA::10}" >> $GITHUB_OUTPUT
- name: Publish to Sonatype
env:
MINESTOM_VERSION: ${{ github.head_ref }}-${{ steps.vars.outputs.short_commit_hash }}
MINESTOM_CHANNEL: snapshot
run: |
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
echo "Version: ${SHORT_COMMIT_HASH}" >> $GITHUB_STEP_SUMMARY

View File

@ -7,7 +7,9 @@ plugins {
alias(libs.plugins.nexuspublish)
}
version = System.getenv("SHORT_COMMIT_HASH") ?: "dev"
// Read env vars (used for publishing generally)
version = System.getenv("MINESTOM_VERSION") ?: "dev"
var channel = System.getenv("MINESTOM_CHANNEL") ?: "local" // local, snapshot, release
allprojects {
apply(plugin = "java")
@ -125,7 +127,8 @@ tasks {
publishing.publications.create<MavenPublication>("maven") {
groupId = "net.minestom"
artifactId = "minestom-snapshots"
// todo: decide on publishing scheme
artifactId = if (channel == "snapshot") "minestom-snapshots" else "minestom-snapshots"
version = project.version.toString()
from(project.components["java"])