Skip to content

Commit

Permalink
Merge pull request #1 from Minecraft-Java-Edition-Speedrunning/CI/CD
Browse files Browse the repository at this point in the history
Set up project for automated management
  • Loading branch information
jan-leila authored Sep 2, 2022
2 parents 8988e08 + e820bb1 commit 233ff21
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 143 deletions.
4 changes: 0 additions & 4 deletions .github/FUNDING.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

26 changes: 0 additions & 26 deletions .github/PULL_REQUEST_TEMPLATE/bug_fix.md

This file was deleted.

22 changes: 0 additions & 22 deletions .github/PULL_REQUEST_TEMPLATE/new_feature.md

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/gradle.yml

This file was deleted.

46 changes: 36 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
name: release-artifacts
name: "publish"

on:
release:
types:
- published
push:
branches:
- "main"
- "master"
paths:
- src/**
- build.gradle
- gradle.properties
- settings.gradle

env:
RELEASE_TITLE: "Sodium 1.16.1 - build ${{github.run_number}}"
RELEASE_TAG: "v${{github.run_number}}"
RELEASE_FILE: "build/libs/*-v${{github.run_number}}.jar"

jobs:
build:
runs-on: ubuntu-latest
publish:
runs-on: "ubuntu-latest"
steps:
- name: Checkout sources
uses: actions/checkout@v2
Expand All @@ -17,8 +28,23 @@ jobs:
java-version: 11
- name: Build artifacts
run: ./gradlew build
- name: Upload assets to GitHub
uses: AButler/upload-release-assets@v2.0
- name: Publish tagged version
uses: "marvinpinto/action-automatic-releases@latest"
with:
automatic_release_tag: "${{ env.RELEASE_TAG }}"
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
title: ${{ env.RELEASE_TITLE }}
files: |
LICENSE*
${{ env.RELEASE_FILE }}
- name: Publish latest
uses: "marvinpinto/action-automatic-releases@latest"
with:
files: 'build/libs/*;LICENSE'
repo-token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: "latest"
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
title: ${{ env.RELEASE_TITLE }}
files: |
LICENSE*
${{ env.RELEASE_FILE }}
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "test"

on:
pull_request:
branches:
- "main"
- "master"
paths:
- src/**
- build.gradle
- gradle.properties
- settings.gradle

jobs:
build:
runs-on: "ubuntu-latest"
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build artifacts
run: ./gradlew build
53 changes: 25 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,29 @@ plugins {
id 'org.ajoberstar.grgit' version '4.1.0'
}

archivesBaseName = "sodium-${project.minecraft_version}-backport-fabric"
version = "${project.mod_version}+${getVersionMetadata()}"
group = project.maven_group
def getVersionMetadata() {
// CI builds version numbers
def build_id = System.getenv("RELEASE_TAG")
if (build_id != null) {
return build_id
}

// Development builds
if (grgit == null) {
return "dev"
}

// Named development builds
def id = grgit.head().abbreviatedId
if (!grgit.status().clean) {
id += "-dirty"
}

return "rev.${id}"
}

archivesBaseName = "${project.mod_id}-${project.minecraft_version}"
version = "${getVersionMetadata()}"

minecraft {
refmapName = "mixins.sodium.refmap.json"
Expand Down Expand Up @@ -34,10 +54,11 @@ if (project.use_third_party_mods) {
}

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

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

Expand All @@ -59,27 +80,3 @@ java {
jar {
from "LICENSE.txt"
}

def getVersionMetadata() {
def build_id = System.getenv("GITHUB_RUN_NUMBER")

// CI builds only
if (build_id != null) {
return "build.${build_id}"
}

if (grgit != null) {
def head = grgit.head()
def id = head.abbreviatedId

// Flag the build if the build tree is not clean
if (!grgit.status().clean) {
id += "-dirty"
}

return "rev.${id}"
}

// No tracking information could be found about the build
return "unknown"
}
6 changes: 1 addition & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://modmuss50.me/fabric.html
mod_id=sodium
minecraft_version=1.16.1
yarn_mappings=1.16.1+build.21
loader_version=0.11.3

# Mod Properties
mod_version=0.2.1
maven_group=me.jellysquid.mods
archives_base_name=sodium-fabric

# If true, third-party mods will be loaded during runtime in the developer run configurations
use_third_party_mods = true
databreaker_version = 0.2.5
14 changes: 7 additions & 7 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"schemaVersion": 1,
"id": "sodium",
"id": "${mod_id}",
"version": "${version}",
"name": "Sodium 1.16.1 Backport",
"description": "Sodium is a free and open-source optimization mod for Minecraft which improves frame rates and reduces lag spikes.\nThis is an unofficial backport of JellySquid's original mod.",
"name": "Sodium 1.16.1",
"description": "Sodium is a free and open-source optimization mod for Minecraft which improves frame rates and reduces lag spikes. \nThis is an unofficial backport of JellySquid's original mod.",
"authors": [
"MrMangoHands"
"jan-leila"
],
"contact": {
"homepage": "https://github.com/mrmangohands/sodium-fabric",
"issues": "https://github.com/mrmangohands/sodium-fabric/issues",
"sources": "https://github.com/mrmangohands/sodium-fabric"
"homepage": "https://github.com/Minecraft-Java-Edition-Speedrunning/mcsr-sodium-1.16.1",
"issues": "https://github.com/Minecraft-Java-Edition-Speedrunning/mcsr-sodium-1.16.1/issues",
"sources": "https://github.com/Minecraft-Java-Edition-Speedrunning/mcsr-sodium-1.16.1"
},
"license": "LGPL-3.0-only",
"icon": "assets/sodium/icon.png",
Expand Down

0 comments on commit 233ff21

Please sign in to comment.