Skip to content

Commit

Permalink
Added auto-release system
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugman76 committed Jan 31, 2021
1 parent e46bbef commit 3cf0749
Show file tree
Hide file tree
Showing 7 changed files with 235 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.

name: Build
name: Check Build
on: [pull_request, push]

jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [
1.8, # Minimum supported by Minecraft
11, # Current Java LTS
15 # Latest version
1.8, # Minimum
11, # LTS
15 # Latest
]
# and run on both Linux and Windows
os: [ubuntu-20.04, windows-latest]
os: [ ubuntu-20.04 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/release_major.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release Major
on: [ workflow_dispatch ] # Manual trigger
jobs:
build:
strategy:
matrix:
java: [ 11 ]
os: [ ubuntu-20.04 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get previous tag
id: previous-tag
uses: WyriHaximus/github-action-get-previous-tag@1.0.0
- name: Get SemVer increments
id: semver
uses: WyriHaximus/github-action-next-semvers@v1.0
with:
version: ${{ steps.previous-tag.outputs.tag }}
- name: Create version tag
uses: actions/github-script@v3
with:
github-token: ${{ github.token }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/v${{ steps.semver.outputs.major }}",
sha: context.sha
})
- name: Fetch tags
run: git fetch --tags
- name: Get current tag
id: current-tag
uses: WyriHaximus/github-action-get-previous-tag@1.0.0
- 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: Make Gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: Build and release
run: ./gradlew generateChangelog build curseforge github modrinth --stacktrace -PlastTag="${{ steps.previous-tag.outputs.tag }}" -PcurrentTag="${{ steps.current-tag.outputs.tag }}"
env:
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_API_KEY }}
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '11' }}
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs/
60 changes: 60 additions & 0 deletions .github/workflows/release_minor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release Minor
on: [ workflow_dispatch ] # Manual trigger
jobs:
build:
strategy:
matrix:
java: [ 11 ]
os: [ ubuntu-20.04 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get previous tag
id: previous-tag
uses: WyriHaximus/github-action-get-previous-tag@1.0.0
- name: Get SemVer increments
id: semver
uses: WyriHaximus/github-action-next-semvers@v1.0
with:
version: ${{ steps.previous-tag.outputs.tag }}
- name: Create version tag
uses: actions/github-script@v3
with:
github-token: ${{ github.token }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/v${{ steps.semver.outputs.minor }}",
sha: context.sha
})
- name: Fetch tags
run: git fetch --tags
- name: Get current tag
id: current-tag
uses: WyriHaximus/github-action-get-previous-tag@1.0.0
- 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: Make Gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: Build and release
run: ./gradlew generateChangelog build curseforge github modrinth --stacktrace -PlastTag="${{ steps.previous-tag.outputs.tag }}" -PcurrentTag="${{ steps.current-tag.outputs.tag }}"
env:
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_API_KEY }}
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '11' }}
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs/
60 changes: 60 additions & 0 deletions .github/workflows/release_patch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release Patch
on: [ workflow_dispatch ] # Manual trigger
jobs:
build:
strategy:
matrix:
java: [ 11 ]
os: [ ubuntu-20.04 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get previous tag
id: previous-tag
uses: WyriHaximus/github-action-get-previous-tag@1.0.0
- name: Get SemVer increments
id: semver
uses: WyriHaximus/github-action-next-semvers@v1.0
with:
version: ${{ steps.previous-tag.outputs.tag }}
- name: Create version tag
uses: actions/github-script@v3
with:
github-token: ${{ github.token }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/v${{ steps.semver.outputs.patch }}",
sha: context.sha
})
- name: Fetch tags
run: git fetch --tags
- name: Get current tag
id: current-tag
uses: WyriHaximus/github-action-get-previous-tag@1.0.0
- 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: Make Gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: Build and release
run: ./gradlew generateChangelog build curseforge github modrinth --stacktrace -PlastTag="${{ steps.previous-tag.outputs.tag }}" -PcurrentTag="${{ steps.current-tag.outputs.tag }}"
env:
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_API_KEY }}
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '11' }}
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs/
80 changes: 3 additions & 77 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,36 +1,10 @@
buildscript {
dependencies {
classpath 'de.guntram.mcmod:crowdin-translate:1.3-pre1-hugman'
}
repositories {
maven {
name = 'CrowdinTranslate source'
url = "https://minecraft.guntram.de/maven/"
}
}
}

plugins {
id 'fabric-loom' version '0.5-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

archivesBaseName = project.mod_id
version = project.mod_version
group = "com.github.DawnTeam"

apply plugin: 'de.guntram.mcmod.crowdin-translate'
crowdintranslate.setCrowdinProjectname 'dawnteam'
crowdintranslate.setMinecraftProjectName project.mod_id
crowdintranslate.setJsonSourceName project.mod_id
apply from: 'https://raw.githubusercontent.com/DawnTeamMC/DawnTeamMC/master/build_template.gradle'

repositories {
jcenter()
mavenLocal()
maven { url 'https://jitpack.io' }
maven { url 'http://maven.terraformersmc.com/' }
}

dependencies {
Expand All @@ -39,55 +13,7 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modApi "com.github.DawnTeamMC:DawnAPI:${project.dawn_version}"
modApi "com.github.DawnTeamMC:DawnAPI:v${project.dawn_version}"

compileOnly "com.google.code.findbugs:jsr305:3.0.2"
}

processResources {
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
}
}

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

def targetVersion = 8
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = targetVersion
}
}

java {
withSourcesJar()
}

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}

build {
dependsOn downloadTranslations
}

publishing {
publications {
mavenJava(MavenPublication) {
artifact(sourcesJar) {
builtBy remapSourcesJar
}

afterEvaluate {
artifact remapJar
}
}
}

repositories {
}
}
45 changes: 39 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,43 @@
org.gradle.jvmargs=-Xmx1G
mod_version=1.3.1

# Mod Metadata
mod_id=wild_explorer
mod_name=Wild Explorer
mod_logo=https://raw.githubusercontent.com/DawnTeamMC/DawnTeamMC/master/wild_explorer/logo.png
mod_color=0x37c10c
mod_default_release_type=stable

# Loader Metadata
loader_name=Fabric
loader_icon=https://fabricmc.net/assets/logo.png

# GitHub Metadata
github_name=WildExplorer

# CurseForge Metadata
curseforge_slug=wild-explorer
curseforge_id=399648
curseforge_game_versions=1.16.2, 1.16.3, 1.16.4, 1.16.5, Fabric
curseforge_embedded_libraries=
curseforge_required_dependencies=fabric-api, dawn
curseforge_optional_dependencies=

# Modrinth Metadata
modrinth_slug=wild_explorer
modrinth_id=GuE5FpvB
modrinth_game_versions=1.16.2, 1.16.3, 1.16.4, 1.16.5
modrinth_mod_loaders=fabric

# check these on https://modmuss50.me/fabric.html
minecraft_version=1.16.4
yarn_mappings=1.16.4+build.7
loader_version=0.10.8
fabric_version=0.28.4+1.16
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.3
loader_version=0.11.1
fabric_version=0.30.0+1.16
# https://github.com/DawnTeamMC/DawnAPI
dawn_version=1.6.1
dawn_version=1.6.2

# Changelog Options
use_project_username=false
changelog_hide_unimportant_commits=true
changelog_max_commit_search=200
discord_webhook_changelog_line_limit=10
16 changes: 8 additions & 8 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"name": "Wild Explorer",
"id": "wild_explorer",
"schemaVersion": 1,
"name": "${mod_name}",
"id": "${mod_id}",
"version": "${version}",
"icon": "assets/wild_explorer/textures/logo.png",
"icon": "assets/${mod_id}/textures/logo.png",
"description": "Fancy and simplistic animals, biomes, structures and more!",
"authors": [
"Hugman",
"Dawn Team"
],
"contact": {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/wild-explorer",
"sources": "https://github.com/DawnTeamMC/WildExplorer",
"issues": "https://github.com/DawnTeamMC/WildExplorer/issues"
"homepage": "https://www.curseforge.com/minecraft/mc-mods/${curseforge_slug}",
"sources": "https://github.com/DawnTeamMC/${github_name}",
"issues": "https://github.com/DawnTeamMC/${github_name}/issues"
},
"environment": "*",
"entrypoints": {
Expand Down Expand Up @@ -39,6 +40,5 @@
"projectID": 399648
}
},
"license": "MIT",
"schemaVersion": 1
"license": "MIT"
}

0 comments on commit 3cf0749

Please sign in to comment.