chore: PR deploy step

This commit is contained in:
mworzala 2023-11-23 10:46:53 +00:00
parent 9e2a200243
commit 8a9439643c
No known key found for this signature in database
GPG Key ID: B148F922E64797C7
2 changed files with 34 additions and 6 deletions

View File

@ -26,7 +26,33 @@ jobs:
# Ignore some of the paths when caching Maven Local repository # Ignore some of the paths when caching Maven Local repository
maven-local-ignore-paths: | maven-local-ignore-paths: |
net/minestom/ net/minestom/
- name: Build Minestom # TODO: reenable
run: ./gradlew classes testClasses # - name: Build Minestom
- name: Run Minestom tests # run: ./gradlew classes testClasses
run: ./gradlew test # - 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) 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 { allprojects {
apply(plugin = "java") apply(plugin = "java")
@ -121,7 +123,7 @@ tasks {
publishing.publications.create<MavenPublication>("maven") { publishing.publications.create<MavenPublication>("maven") {
groupId = "dev.hollowcube" groupId = "dev.hollowcube"
artifactId = "minestom-ce" artifactId = if (channel == "snapshot") "minestom-ce-snapshots" else "minestom-ce"
version = project.version.toString() version = project.version.toString()
from(project.components["java"]) from(project.components["java"])