9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00

update build file

This commit is contained in:
NONPLAYT
2025-01-19 02:02:49 +03:00
parent 36bc4cc41a
commit 22ef0b1df3
5 changed files with 132 additions and 39 deletions

View File

@@ -1,15 +1,10 @@
name: Build DivineMC
name: DivineMC CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- "ver/**"
env:
version: '1.21.4'
branch: 'ver/1.21.4'
debug: 'false'
- "master"
workflow_dispatch:
jobs:
build:
@@ -17,13 +12,13 @@ jobs:
if: "!contains(github.event.commits[0].message, '[ci-skip]')"
steps:
- name: Setup Action
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup JDK 21
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
@@ -32,7 +27,6 @@ jobs:
- name: Configure Git and Gradle
run: |
git config --global user.email "no-reply@github.com" && git config --global user.name "Github Actions"
echo "workflow=$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
echo "BUILD_NUMBER=$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
chmod +x gradlew
@@ -46,29 +40,18 @@ jobs:
continue-on-error: true
run: ./gradlew publish -PdivinemcUsername=${{ secrets.REPO_USERNAME }} -PdivinemcPassword=${{ secrets.REPO_SECRET }}
- name: Upload Artifacts
if: env.debug == 'true' || github.ref_name != env.branch
uses: actions/upload-artifact@main
with:
name: DivineMC
path: divinemc-server/build/libs/divinemc-paperclip-*-mojmap.jar
- name: Get Release Info
run: bash scripts/releaseInfo.sh
env:
BUILD_NUMBER: ${{ env.BUILD_NUMBER }}
- name: Release Artifacts
if: github.ref_name == env.branch
uses: marvinpinto/action-automatic-releases@latest
- name: Create Release
uses: ncipollo/release-action@latest
with:
title: "Release #${{ env.workflow }}"
automatic_release_tag: release-${{ env.workflow }}
repo_token: "${{ secrets.GITHUB_TOKEN }}"
files: divinemc-server/build/libs/divinemc-paperclip-*-mojmap.jar
prerelease: false
- name: Release Artifacts (Latest)
if: github.ref_name == env.branch
uses: marvinpinto/action-automatic-releases@latest
with:
title: "Release #${{ env.workflow }}"
automatic_release_tag: latest-${{ env.version }}
repo_token: "${{ secrets.GITHUB_TOKEN }}"
files: divinemc-server/build/libs/divinemc-paperclip-*-mojmap.jar
prerelease: false
artifacts: ${{ env.jar }}
bodyFile: ${{ env.info }}
tag: ${{ env.tag }}
name: ${{ env.name }}
prerelease: ${{ env.experimental }}
token: ${{ secrets.GITHUB_TOKEN }}
makeLatest: ${{ env.make_latest }}

43
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: DivineMC Test CI
on:
push:
branches-ignore: [ master ]
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.commits[0].message, '[ci-skip]')"
steps:
- name: Setup Action
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: 'gradle'
- name: Configure Git and Gradle
run: |
git config --global user.email "no-reply@github.com" && git config --global user.name "Github Actions"
echo "BUILD_NUMBER=$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
chmod +x gradlew
- name: Patch
run: ./gradlew applyAllPatches --stacktrace
- name: Build Paperclip Jar
run: ./gradlew createMojmapPaperclipJar --stacktrace
- name: Upload Artifacts
uses: actions/upload-artifact@main
with:
name: DivineMC
path: divinemc-server/build/libs/divinemc-paperclip-*-mojmap.jar

1
.gitignore vendored
View File

@@ -13,3 +13,4 @@ run
/paper-api
/purpur-api
*.jar
changelog.md

View File

@@ -3,6 +3,7 @@ group = space.bxteam.divinemc
mcVersion=1.21.4
version=1.21.4-R0.1-SNAPSHOT
purpurRef=a9bcd9f0c8b66ad84f9ca6005d425902c9cd0442
experimental=false
org.gradle.configuration-cache=true
org.gradle.caching = true

65
scripts/releaseInfo.sh Normal file
View File

@@ -0,0 +1,65 @@
#!/usr/bin/env bash
sha256() {
sha256sum "$1" | awk '{print $1}'
}
sha1() {
sha1sum "$1" | awk '{print $1}'
}
md5() {
md5sum "$1" | awk '{print $1}'
}
prop() {
grep "${1}" gradle.properties | cut -d'=' -f2 | sed 's/\r//'
}
commitid=$(git log --pretty='%h' -1)
mcversion=$(prop mcVersion)
version=$(prop version)
experimental=$(prop experimental)
tagid="$mcversion-$BUILD_NUMBER-$commitid"
jarName="divinemc-$mcversion-$BUILD_NUMBER.jar"
divinemcid="DivineMC-$tagid"
changelog="changelog.md"
make_latest=$([ "$experimental" = "true" ] && echo "false" || echo "true")
rm -f $changelog
mv divinemc-server/build/libs/divinemc-paperclip-"$version"-mojmap.jar "$jarName"
{
echo "name=$divinemcid"
echo "tag=$tagid"
echo "jar=$jarName"
echo "info=$changelog"
echo "experimental=$experimental"
echo "make_latest=$make_latest"
} >> "$GITHUB_ENV"
{
echo "$divinemcid [![download](https://img.shields.io/github/downloads/DivineMC/DivineMC/$tagid/total?color=0)](https://github.com/DivineMC/DivineMC/releases/download/$tagid/$jarName)"
echo "====="
echo ""
if [ "$experimental" = "true" ]; then
echo "> This is an early, experimental build. It is only recommended for usage on test servers and should be used with caution."
echo "> **Backups are mandatory!**"
echo ""
fi
echo "### Commits"
} >> $changelog
number=$(git log --oneline master ^"$(git describe --tags --abbrev=0)" | wc -l)
git log --pretty='> [%h] %s' "-$number" >> $changelog
{
echo ""
echo "### Checksum"
echo "| File | $jarName |"
echo "| ---- | ---- |"
echo "| MD5 | $(md5 "$jarName") |"
echo "| SHA1 | $(sha1 "$jarName") |"
echo "| SHA256 | $(sha256 "$jarName") |"
} >> $changelog