Skip to content

Commit

Permalink
Modernize CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Jul 23, 2024
1 parent afe3837 commit 726fcd3
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 29 deletions.
55 changes: 27 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -66,15 +74,6 @@ 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') || startsWith(github.ref, 'refs/heads/feature')
env:
Expand All @@ -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
14 changes: 14 additions & 0 deletions .github/workflows/publish-github-release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'net.neoforged.gradle.mixin' version '7.0.97'
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.+'
}
Expand Down

0 comments on commit 726fcd3

Please sign in to comment.