Add build GH pipeline
This commit is contained in:
44
.github/workflows/build.yml
vendored
Normal file
44
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
name: Build
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
types: [ opened, synchronize, reopened ]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
java: [
|
||||||
|
17
|
||||||
|
]
|
||||||
|
os: [ ubuntu-latest ]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||||
|
- name: Validate Gradle wrapper
|
||||||
|
uses: gradle/wrapper-validation-action@v1
|
||||||
|
- name: Setup JDK ${{ matrix.java }}
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: ${{ matrix.java }}
|
||||||
|
- name: Cache Gradle packages
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/caches
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
|
||||||
|
restore-keys: ${{ runner.os }}-gradle
|
||||||
|
- name: Make Gradle wrapper executable
|
||||||
|
if: ${{ runner.os != 'Windows' }}
|
||||||
|
run: chmod +x ./gradlew
|
||||||
|
- name: Build
|
||||||
|
run: ./gradlew build
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Upload build artifacts
|
||||||
|
if: ${{ runner.os == 'Linux' && matrix.java == '17' }}
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: Artifacts
|
||||||
|
path: build/libs/
|
65
build.gradle
65
build.gradle
@@ -26,15 +26,18 @@ repositories {
|
|||||||
apply plugin: 'net.minecraftforge.gradle'
|
apply plugin: 'net.minecraftforge.gradle'
|
||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
apply from: 'https://raw.githubusercontent.com/SizableShrimp/Forge-Class-Remapper/main/classremapper.gradle'
|
|
||||||
|
|
||||||
version = '1.10.0'
|
|
||||||
def env = System.getenv()
|
|
||||||
if (env.BUILD_NUMBER) {
|
|
||||||
version = version + "+" + "${env.BUILD_NUMBER}"
|
|
||||||
}
|
|
||||||
group = 'com.refinedmods'
|
group = 'com.refinedmods'
|
||||||
archivesBaseName = 'refinedstorage'
|
archivesBaseName = 'refinedstorage'
|
||||||
|
version = '1.10.0'
|
||||||
|
|
||||||
|
if (System.getenv('GITHUB_SHA') != null) {
|
||||||
|
version += '+' + System.getenv('GITHUB_SHA').substring(0, 7)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (System.getenv('RELEASE') != null) {
|
||||||
|
version = System.getenv('RELEASE').substring(1) // remove 'v'
|
||||||
|
}
|
||||||
|
|
||||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
|
||||||
@@ -123,53 +126,3 @@ jar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jar.finalizedBy('reobfJar')
|
jar.finalizedBy('reobfJar')
|
||||||
|
|
||||||
task apiJar(type: Jar, dependsOn: 'classes') {
|
|
||||||
classifier = 'api'
|
|
||||||
from(sourceSets.main.output) {
|
|
||||||
include 'com/refinedmods/refinedstorage/api/**'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
||||||
classifier = 'sources'
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
}
|
|
||||||
|
|
||||||
task deobfJar(type:Jar) {
|
|
||||||
from sourceSets.main.output
|
|
||||||
classifier 'deobf'
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
archives jar
|
|
||||||
archives sourcesJar
|
|
||||||
archives deobfJar
|
|
||||||
archives apiJar
|
|
||||||
}
|
|
||||||
|
|
||||||
test {
|
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
groupId = project.group
|
|
||||||
artifactId = project.archivesBaseName
|
|
||||||
version = project.version
|
|
||||||
artifact jar
|
|
||||||
artifact sourcesJar
|
|
||||||
artifact deobfJar
|
|
||||||
artifact apiJar
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url "/var/www/repo"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user