diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index 8c185f0d..a31c4958 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -1,22 +1,38 @@ name: Gradle Build -on: [push, pull_request] +on: + workflow_dispatch: + push: + branches: + - '*' + pull_request: + branches: + - '*' jobs: build: + strategy: + matrix: + java: [ 20 ] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 20 - uses: actions/setup-java@v2 + - uses: actions/checkout@v3 with: - java-version: 20 + fetch-depth: 0 + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.java }} distribution: 'temurin' + cache: 'gradle' - name: Build with Gradle - run: ./gradlew build + uses: gradle/gradle-build-action@v2 + with: + arguments: build --parallel --stacktrace + cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/1.') && !startsWith(github.ref, 'refs/heads/dev/') && !startsWith(github.ref, 'refs/tags/v') }} - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: Artifacts path: ./build/libs/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..48283046 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +name: Publish Release + +on: [workflow_dispatch] # Manual trigger + +permissions: + contents: write + +jobs: + Build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 20 + uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: 20 + - name: Cache + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + .gradle + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'build.gradle') }} + - uses: gradle/wrapper-validation-action@v1 + - run: | + chmod +x gradlew + ./gradlew build publishCurseForge publish modrinth --stacktrace -Porg.gradle.parallel.threads=4 + env: + CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} \ No newline at end of file