🔀 Merge pull request #65 from Snd-R/main #68
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Snapshot | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
check-version: | |
runs-on: ubuntu-latest | |
outputs: | |
is_snapshot: ${{ steps.check_snapshot.outputs.is_snapshot }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Check for SNAPSHOT suffix | |
id: check_snapshot | |
run: | | |
VERSION_NAME=$(grep "^VERSION_NAME=" gradle.properties | cut -d '=' -f 2) | |
if [[ $VERSION_NAME == *-SNAPSHOT ]]; then | |
echo "::set-output name=is_snapshot::true" | |
else | |
echo "::set-output name=is_snapshot::false" | |
fi | |
publish: | |
name: Publish to Snapshot | |
runs-on: ubuntu-latest | |
needs: check-version | |
if: ${{ needs.check-version.outputs.is_snapshot == 'true' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Upload Artifacts | |
run: ./gradlew publishAllPublicationsToMavenCentralRepository | |
env: | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} |