Skip to content

Commit 233ff21

Browse files
authored
Merge pull request #1 from Minecraft-Java-Edition-Speedrunning/CI/CD
Set up project for automated management
2 parents 8988e08 + e820bb1 commit 233ff21

File tree

10 files changed

+94
-143
lines changed

10 files changed

+94
-143
lines changed

.github/FUNDING.yml

-4
This file was deleted.

.github/ISSUE_TEMPLATE/feature_request.md

-20
This file was deleted.

.github/PULL_REQUEST_TEMPLATE/bug_fix.md

-26
This file was deleted.

.github/PULL_REQUEST_TEMPLATE/new_feature.md

-22
This file was deleted.

.github/workflows/gradle.yml

-21
This file was deleted.

.github/workflows/publish.yml

+36-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
name: release-artifacts
1+
name: "publish"
22

33
on:
4-
release:
5-
types:
6-
- published
4+
push:
5+
branches:
6+
- "main"
7+
- "master"
8+
paths:
9+
- src/**
10+
- build.gradle
11+
- gradle.properties
12+
- settings.gradle
13+
14+
env:
15+
RELEASE_TITLE: "Sodium 1.16.1 - build ${{github.run_number}}"
16+
RELEASE_TAG: "v${{github.run_number}}"
17+
RELEASE_FILE: "build/libs/*-v${{github.run_number}}.jar"
718

819
jobs:
9-
build:
10-
runs-on: ubuntu-latest
20+
publish:
21+
runs-on: "ubuntu-latest"
1122
steps:
1223
- name: Checkout sources
1324
uses: actions/checkout@v2
@@ -17,8 +28,23 @@ jobs:
1728
java-version: 11
1829
- name: Build artifacts
1930
run: ./gradlew build
20-
- name: Upload assets to GitHub
21-
uses: AButler/[email protected]
31+
- name: Publish tagged version
32+
uses: "marvinpinto/action-automatic-releases@latest"
33+
with:
34+
automatic_release_tag: "${{ env.RELEASE_TAG }}"
35+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
36+
prerelease: false
37+
title: ${{ env.RELEASE_TITLE }}
38+
files: |
39+
LICENSE*
40+
${{ env.RELEASE_FILE }}
41+
- name: Publish latest
42+
uses: "marvinpinto/action-automatic-releases@latest"
2243
with:
23-
files: 'build/libs/*;LICENSE'
24-
repo-token: ${{ secrets.GITHUB_TOKEN }}
44+
automatic_release_tag: "latest"
45+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
46+
prerelease: false
47+
title: ${{ env.RELEASE_TITLE }}
48+
files: |
49+
LICENSE*
50+
${{ env.RELEASE_FILE }}

.github/workflows/test.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "test"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "main"
7+
- "master"
8+
paths:
9+
- src/**
10+
- build.gradle
11+
- gradle.properties
12+
- settings.gradle
13+
14+
jobs:
15+
build:
16+
runs-on: "ubuntu-latest"
17+
steps:
18+
- name: Checkout sources
19+
uses: actions/checkout@v2
20+
- name: Set up JDK 11
21+
uses: actions/setup-java@v1
22+
with:
23+
java-version: 11
24+
- name: Build artifacts
25+
run: ./gradlew build

build.gradle

+25-28
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,29 @@ plugins {
33
id 'org.ajoberstar.grgit' version '4.1.0'
44
}
55

6-
archivesBaseName = "sodium-${project.minecraft_version}-backport-fabric"
7-
version = "${project.mod_version}+${getVersionMetadata()}"
8-
group = project.maven_group
6+
def getVersionMetadata() {
7+
// CI builds version numbers
8+
def build_id = System.getenv("RELEASE_TAG")
9+
if (build_id != null) {
10+
return build_id
11+
}
12+
13+
// Development builds
14+
if (grgit == null) {
15+
return "dev"
16+
}
17+
18+
// Named development builds
19+
def id = grgit.head().abbreviatedId
20+
if (!grgit.status().clean) {
21+
id += "-dirty"
22+
}
23+
24+
return "rev.${id}"
25+
}
26+
27+
archivesBaseName = "${project.mod_id}-${project.minecraft_version}"
28+
version = "${getVersionMetadata()}"
929

1030
minecraft {
1131
refmapName = "mixins.sodium.refmap.json"
@@ -34,10 +54,11 @@ if (project.use_third_party_mods) {
3454
}
3555

3656
processResources {
57+
inputs.property "mod_id", project.mod_id
3758
inputs.property "version", project.version
3859

3960
filesMatching("fabric.mod.json") {
40-
expand "version": project.version
61+
expand "mod_id": project.mod_id, "version": project.version
4162
}
4263
}
4364

@@ -59,27 +80,3 @@ java {
5980
jar {
6081
from "LICENSE.txt"
6182
}
62-
63-
def getVersionMetadata() {
64-
def build_id = System.getenv("GITHUB_RUN_NUMBER")
65-
66-
// CI builds only
67-
if (build_id != null) {
68-
return "build.${build_id}"
69-
}
70-
71-
if (grgit != null) {
72-
def head = grgit.head()
73-
def id = head.abbreviatedId
74-
75-
// Flag the build if the build tree is not clean
76-
if (!grgit.status().clean) {
77-
id += "-dirty"
78-
}
79-
80-
return "rev.${id}"
81-
}
82-
83-
// No tracking information could be found about the build
84-
return "unknown"
85-
}

gradle.properties

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://modmuss50.me/fabric.html
6+
mod_id=sodium
67
minecraft_version=1.16.1
78
yarn_mappings=1.16.1+build.21
89
loader_version=0.11.3
910

10-
# Mod Properties
11-
mod_version=0.2.1
12-
maven_group=me.jellysquid.mods
13-
archives_base_name=sodium-fabric
14-
1511
# If true, third-party mods will be loaded during runtime in the developer run configurations
1612
use_third_party_mods = true
1713
databreaker_version = 0.2.5

src/main/resources/fabric.mod.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"schemaVersion": 1,
3-
"id": "sodium",
3+
"id": "${mod_id}",
44
"version": "${version}",
5-
"name": "Sodium 1.16.1 Backport",
6-
"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.",
5+
"name": "Sodium 1.16.1",
6+
"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.",
77
"authors": [
8-
"MrMangoHands"
8+
"jan-leila"
99
],
1010
"contact": {
11-
"homepage": "https://github.com/mrmangohands/sodium-fabric",
12-
"issues": "https://github.com/mrmangohands/sodium-fabric/issues",
13-
"sources": "https://github.com/mrmangohands/sodium-fabric"
11+
"homepage": "https://github.com/Minecraft-Java-Edition-Speedrunning/mcsr-sodium-1.16.1",
12+
"issues": "https://github.com/Minecraft-Java-Edition-Speedrunning/mcsr-sodium-1.16.1/issues",
13+
"sources": "https://github.com/Minecraft-Java-Edition-Speedrunning/mcsr-sodium-1.16.1"
1414
},
1515
"license": "LGPL-3.0-only",
1616
"icon": "assets/sodium/icon.png",

0 commit comments

Comments
 (0)