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

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 /paper-api
/purpur-api /purpur-api
*.jar *.jar
changelog.md

View File

@@ -1,8 +1,9 @@
group = space.bxteam.divinemc group = space.bxteam.divinemc
mcVersion = 1.21.4 mcVersion=1.21.4
version = 1.21.4-R0.1-SNAPSHOT version=1.21.4-R0.1-SNAPSHOT
purpurRef = a9bcd9f0c8b66ad84f9ca6005d425902c9cd0442 purpurRef=a9bcd9f0c8b66ad84f9ca6005d425902c9cd0442
experimental=false
org.gradle.configuration-cache=true org.gradle.configuration-cache=true
org.gradle.caching = 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