diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1fc8c48..34ac5f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,28 +1,31 @@ name: "CI" on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: name: Build runs-on: ubuntu-latest steps: - name: 'Checkout' - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: true - - name: 'Cache' - uses: actions/cache@v2 - with: - path: | - ~/.m2 - ~/.gradle - key: ${{ runner.os }}-gradle-${{ hashFiles('build.gradle') }} - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 + - name: 'Validate Gradle wrapper' + uses: gradle/actions/wrapper-validation@v3 - name: 'Setup Java' - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 + with: + distribution: 'microsoft' + java-version: 21 + - name: 'Setup Gradle' + uses: gradle/actions/setup-gradle@v3 with: - java-version: 17 - java-package: jdk + gradle-version: wrapper + cache-read-only: false - name: 'Mark tag as release' if: startsWith(github.ref, 'refs/tags/') run: echo "RELEASE=true" >> $GITHUB_ENV @@ -41,7 +44,7 @@ jobs: if: ${{ env.KEYSTORE_BASE64 }} run: cp ${{ steps.unlock_keystore.outputs.filePath }} . - name: 'Build' - run: ./gradlew build --max-workers 1 + run: ./gradlew build --no-daemon env: SIGN_KEYSTORE: ${{ secrets.SIGN_KEYSTORE }} SIGN_ALIAS: ${{ secrets.SIGN_ALIAS }} @@ -56,6 +59,11 @@ jobs: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} if: ${{ env.COVERALLS_REPO_TOKEN }} run: ./gradlew test jacocoTestReport coveralls + - name: 'Deploy as GitHub CI artifacts' + uses: actions/upload-artifact@v4 + with: + if-no-files-found: error + path: build/libs/* - name: 'Deploy to CurseForge' if: startsWith(github.ref, 'refs/tags/') env: @@ -66,17 +74,8 @@ jobs: env: MODRINTH_KEY_SECRET: ${{ secrets.MODRINTH_KEY_SECRET }} run: ./gradlew modrinth - - name: 'Create GitHub release' - id: create_release - if: startsWith(github.ref, 'refs/tags/') - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - name: 'Deploy to Maven' - if: startsWith(github.ref, 'refs/heads/master') + if: startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/feature') env: MAVEN_URL: ${{ secrets.MAVEN_URL }} MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} @@ -84,9 +83,9 @@ jobs: run: ./gradlew publish - name: 'Deploy JavaDoc to GitHub Pages' if: startsWith(github.ref, 'refs/heads/master') - uses: JamesIves/github-pages-deploy-action@3.6.2 + uses: JamesIves/github-pages-deploy-action@v4 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH: gh-pages - FOLDER: build/docs/javadoc - CLEAN: true + token: ${{ secrets.GITHUB_TOKEN }} + branch: gh-pages + folder: build/docs/javadoc + clean: true diff --git a/.github/workflows/publish-github-release.yml b/.github/workflows/publish-github-release.yml new file mode 100644 index 0000000..83e7477 --- /dev/null +++ b/.github/workflows/publish-github-release.yml @@ -0,0 +1,14 @@ +name: Publish GitHub release on version tags +on: + push: + tags: + - '*' +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle b/build.gradle index ce9e608..239ecdc 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ plugins { id 'net.neoforged.gradle.userdev' version '7.0.145' id 'net.darkhax.curseforgegradle' version '1.0.8' id 'com.github.kt3k.coveralls' version '2.12.0' - id 'com.diffplug.spotless' version '5.14.3' + id 'com.diffplug.spotless' version '6.25.0' id 'com.github.johnrengelman.shadow' version '8.1.1' id 'com.modrinth.minotaur' version '2.+' }