Add modrinth publishing (#2) #2
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 to Hangar | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
environment: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gradle/wrapper-validation-action@v1 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Build with Gradle | |
run: ./gradlew --build-cache build | |
- name: Test with Gradle | |
run: ./gradlew test | |
- name: Publish release to hangar | |
if: github.ref_name == 'main' | |
env: | |
HANGAR_KEY: ${{ secrets.HANGAR_KEY }} | |
HANGAR_CHANNEL: Release | |
run: ./gradlew publishAllPublicationsToHangar | |
- name: Publish dev to hangar | |
if: github.ref_name == 'dev' | |
env: | |
HANGAR_KEY: ${{ secrets.HANGAR_KEY }} | |
HANGAR_CHANNEL: Development | |
run: ./gradlew publishAllPublicationsToHangar |