diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..fcd07d8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: Java CI with Gradle + +on: + push: + tags-ignore: + - '**' + branches: + - '**' + pull_request: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + submodules: true + - uses: gradle/wrapper-validation-action@v1 + - uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + - name: Build with Gradle + run: ./gradlew build --no-daemon + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: build-artifacts + path: | + build/libs/ diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..c8009e7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,39 @@ +name: Publish release + +on: + release: + types: + - published + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + submodules: true + - uses: gradle/wrapper-validation-action@v1 + - uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + - name: Build and publish with Gradle + run: ./gradlew build modrinth --no-daemon + env: + BUILD_RELEASE: ${{github.event.prelease == false}} + MODRINTH_TOKEN: ${{secrets.MODRINTH}} + CHANGELOG: ${{ github.event.release.body }} + - name: Upload build artifacts + uses: AButler/upload-release-assets@v2.0 + with: + files: 'build/libs/*' + repo-token: ${{secrets.GITHUB_TOKEN}}