Skip to content

Commit

Permalink
It is finally out I guess
Browse files Browse the repository at this point in the history
  • Loading branch information
3TUSK committed Aug 20, 2020
0 parents commit 1b50b77
Show file tree
Hide file tree
Showing 21 changed files with 1,084 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Keep CRLF for *.bat files which are for Windows.
# Ref: https://stackoverflow.com/questions/21822650
*.bat -crlf
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: release
on:
push:
tags:
- "**"
jobs:
publish:
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# Fetch all history
fetch-depth: 0
- name: Maven Publish
id: maven_publish
env:
MAVEN_USERNAME: ${{ secrets.TEACON_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.TEACON_PASSWORD }}
run: ./gradlew publishReleasePublicationToArchiveRepository githubActionOutput
- name: Generate Changelog
id: changelog
shell: bash
env:
CURRENT: ${{ github.ref }}
# Special thanks to this post on Stack Overflow regarding change set between two tags:
# https://stackoverflow.com/questions/12082981
# Do note that actions/checkout will enter detach mode by default, so you won't have
# access to HEAD ref. Use GitHub-Action-supplied `github.ref` instead.
# Special thanks to this issue ticket regarding escaping newline:
# https://github.com/actions/create-release/issues/25
# We use Bash parameter expansion to do find-and-replace.
# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
# Also we cannot use git rev-list because it always prepend "commit <hash>"
# See https://stackoverflow.com/questions/36927089/
run: |
current_tag=${CURRENT/refs\/tags\//}
last_tag=`git describe --tags --abbrev=0 "$current_tag"^ 2>/dev/null || echo`
if [ last_tag ]; then
changelog=`git log --pretty="format:%H: %s" ${last_tag}..$current_tag`
else
changelog=`git log --pretty="format:%H: %s"`
fi
changelog="${changelog//'%'/'%25'}"
changelog="${changelog//$'\n'/' %0A'}"
echo "::set-output name=value::Change set since ${last_tag:-the beginning}: %0A%0A$changelog"
- name: GitHub Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
body: |
${{ steps.changelog.outputs.value }}
- name: GitHub Release Artifact
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.maven_publish.outputs.artifact_path }}
asset_name: ${{ steps.maven_publish.outputs.artifact_name }}
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
asset_content_type: "application/java-archive"
14 changes: 14 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: test-build
on:
push:
paths:
- "src/**"
- "build.gradle"
jobs:
build:
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
run: ./gradlew build --stacktrace
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project

# idea
out
*.ipr
*.iws
*.iml
.idea

# vscode
.vscode

# gradle
build
.gradle

# other
eclipse
run
*.txt

24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 2020, TeaConMC members and contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the TeaConMC nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL TEACONMC MEMBERS AND CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
149 changes: 149 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
import java.time.Instant
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoUnit

buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
}
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '0.1.0'
group = 'org.teacon'
archivesBaseName = 'AreaControl-Forge-1.15'

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'

minecraft {
mappings channel: 'snapshot', version: '20200513-1.15.1'

runs {
client {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'info'
mods {
area_control {
source sourceSets.main
}
}
}

server {
workingDirectory project.file('run_server')
property 'forge.logging.console.level', 'info'
mods {
area_control {
source sourceSets.main
}
}
}

data {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'info'
args '--mod', 'area_control', '--all', '--output', file('src/generated/resources/')
mods {
area_control {
source sourceSets.main
}
}
}
}
}

dependencies {
minecraft 'net.minecraftforge:forge:1.15.2-31.2.4'
}

jar {
manifest {
attributes([
"Specification-Title": "Area-Control",
"Specification-Vendor": "TeaConMC",
"Specification-Version": "1",
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor": "TeaConMC",
"Implementation-Timestamp": DateTimeFormatter.ISO_INSTANT.format(Instant.now().truncatedTo(ChronoUnit.SECONDS))
])
}
}

def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) {
type 'jar'
builtBy 'reobfJar'
}
publishing {
publications {
release(MavenPublication) {
groupId = "org.teacon"
artifactId = "AreaControl-Forge-1.15"

artifact reobfArtifact
pom {
name = 'AreaControl for Minecraft 1.15'
description = 'Comprehensive (maybe) plot management mod'
url = 'https://github.com/teaconmc/AreaControl'
licenses {
license {
name = 'BSD-3-Clause'
url = 'https://github.com/teaconmc/AreaControl/blob/1.15-forge/LICENSE'
}
}
developers {
developer {
id = '3TUSK'
name = '3TUSK'
}
}
issueManagement {
system = 'GitHub Issues'
url = 'https://github.com/teaconmc/AreaControl/issues'
}
scm {
url = 'https://github.com/teaconmc/AreaControl'
connection = 'scm:git:git://github.com/teaconmc/AreaControl.git'
developerConnection = 'scm:git:[email protected]:teaconmc/AreaControl.git'
}
}
}
}
repositories {
maven {
name = "archive"
url = "https://maven.hub.tritusk.info/releases"
credentials {
username = System.env.MAVEN_USERNAME
password = System.env.MAVEN_PASSWORD
}
}
}
}

tasks.withType(PublishToMavenRepository) {
onlyIf {
System.env.MAVEN_USERNAME && System.env.MAVEN_PASSWORD
}
}

/**
* A simple task to pass down the artifact name and path to other GitHub actions.
*/
task("githubActionOutput") {
onlyIf {
System.env.GITHUB_ACTIONS
}
doLast {
println "::set-output name=artifact_path::$buildDir/reobfJar/output.jar"
println "::set-output name=artifact_name::$archivesBaseName-${version}.jar"
}
}
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ensure enough heap space during deployment
org.gradle.jvmargs=-Xmx3G
# It is said that daemon often brings more issues, so we disable it.
org.gradle.daemon=false
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
Loading

0 comments on commit 1b50b77

Please sign in to comment.