Skip to content

Commit

Permalink
fix build & add action
Browse files Browse the repository at this point in the history
  • Loading branch information
sisby-folk committed Aug 23, 2024
1 parent 074423a commit 8893a31
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build

on: [ push, pull_request ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup jdk
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
validate-wrappers: true

- name: Build with Gradle
run: ./gradlew build

- name: capture build artifacts
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/
15 changes: 9 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ dependencies {
modImplementation libs.fl

modImplementation libs.fapi

modCompileOnly libs.tabs
}

processResources {
Expand All @@ -49,13 +51,13 @@ processResources {

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 8
it.options.release = 21
}

java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
Expand All @@ -65,19 +67,20 @@ jar {
}

githubRelease {
token = System.getenv("GITHUB_TOKEN")
token = "$System.env.GITHUB_TOKEN"
owner = project.user
repo = slug
tagName = "v${baseVersion}+${tagBranch}"
targetCommitish = tagBranch
releaseAssets = remapJar
releaseName = "v${baseVersion}"
allowUploadToExisting = (tagBranch != branch)
allowUploadToExisting = true
generateReleaseNotes = true
body = !file("CHANGELOG.md").exists() ? "" : rootProject.file("CHANGELOG.md").text
}

modrinth {
token = System.getenv("MODRINTH_TOKEN")
token = "$System.env.MODRINTH_TOKEN"
projectId = slug
versionNumber = project.version
uploadFile = remapJar
Expand Down

0 comments on commit 8893a31

Please sign in to comment.