2020-11-16 00:55:04 +01:00
|
|
|
name: Build and test Minestom
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
2023-09-18 23:20:53 +02:00
|
|
|
branches: [ master ]
|
2020-11-16 00:55:04 +01:00
|
|
|
|
|
|
|
jobs:
|
2024-02-07 04:24:04 +01:00
|
|
|
tests:
|
2020-11-16 00:55:04 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2024-03-28 17:09:18 +01:00
|
|
|
- name: Set up JDK 21
|
2021-07-06 16:07:58 +02:00
|
|
|
uses: actions/setup-java@v2
|
2020-11-16 00:55:04 +01:00
|
|
|
with:
|
2021-10-22 01:55:55 +02:00
|
|
|
distribution: 'zulu'
|
2024-03-28 17:09:18 +01:00
|
|
|
java-version: 21
|
2020-11-16 00:55:04 +01:00
|
|
|
- name: Grant execute permission for gradlew
|
|
|
|
run: chmod +x gradlew
|
2020-11-19 11:40:19 +01:00
|
|
|
- name: Setup gradle cache
|
|
|
|
uses: burrunan/gradle-cache-action@v1
|
|
|
|
with:
|
|
|
|
save-generated-gradle-jars: false
|
|
|
|
save-local-build-cache: false
|
|
|
|
save-gradle-dependencies-cache: true
|
|
|
|
save-maven-dependencies-cache: true
|
|
|
|
# Ignore some of the paths when caching Maven Local repository
|
|
|
|
maven-local-ignore-paths: |
|
|
|
|
net/minestom/
|
2024-02-07 04:24:04 +01:00
|
|
|
- name: Build Minestom
|
|
|
|
run: ./gradlew classes testClasses
|
|
|
|
- name: Run Minestom tests
|
|
|
|
run: ./gradlew test
|
2023-11-23 11:46:53 +01:00
|
|
|
publish:
|
|
|
|
runs-on: ubuntu-latest
|
2024-02-21 03:32:11 +01:00
|
|
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
2023-11-23 11:46:53 +01:00
|
|
|
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
|
2024-03-28 17:09:18 +01:00
|
|
|
- name: Set up JDK 21
|
2023-11-23 11:46:53 +01:00
|
|
|
uses: actions/setup-java@v2
|
|
|
|
with:
|
2024-03-28 17:09:18 +01:00
|
|
|
java-version: '21'
|
2023-11-23 11:46:53 +01:00
|
|
|
distribution: 'temurin'
|
|
|
|
- name: Set outputs
|
|
|
|
id: vars
|
2023-12-18 06:08:13 +01:00
|
|
|
run: |
|
|
|
|
export ACTUAL=${{ github.event.pull_request.head.sha }}
|
|
|
|
echo "short_commit_hash=${ACTUAL::10}" >> $GITHUB_OUTPUT
|
2023-11-23 11:46:53 +01:00
|
|
|
- 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
|