9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-26 02:09:30 +00:00

[ci-skip] update .github dir

This commit is contained in:
NONPLAYT
2025-04-27 14:06:50 +03:00
parent 4cde401243
commit 2c364c71c9
10 changed files with 273 additions and 85 deletions

82
.github/workflows/auto-update.yml vendored Normal file
View File

@@ -0,0 +1,82 @@
name: Automatically Upstream Purpur
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout DivineMC repository
uses: actions/checkout@main
with:
path: 'DivineMC'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Purpur repository
uses: actions/checkout@main
with:
path: 'Purpur'
repository: "PurpurMC/Purpur"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get Purpur latest commit Hash
id: purpurCommit
run: |
cd Purpur
echo "purpurRef=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Get Current Purpur commit Hash
id: currPurpurRef
run: |
cd DivineMC
currPurpurRef=$(grep "^purpurRef\s*=" gradle.properties | sed 's/^purpurRef\s*=\s*//')
echo "currPurpurRef=$currPurpurRef" >> $GITHUB_OUTPUT
- name: Update purpurRef in DivineMC
run: |
cd DivineMC
sed -i "s/\(purpurRef\s*=\s*\).*/\1$PURPUR_REF/" gradle.properties
env:
PURPUR_REF: ${{ steps.purpurCommit.outputs.purpurRef }}
- name: Setup Git and Gradle
run: |
cd DivineMC
git config --global user.email "action@github.com"
git config --global user.name "Github Action"
chmod +x gradlew
- name: Setup JDK 21
uses: actions/setup-java@main
with:
distribution: 'temurin'
java-version: '21'
- name: Running tests before push
run: |
cd DivineMC
if ! git diff --quiet; then
echo "Running tests...."
./gradlew applyAllPatches
./gradlew build -x test
./gradlew rebuildPurpurPatches
./gradlew rebuildAllServerPatches
fi
- name: Check for changes and write to repository
run: |
cd DivineMC
if ! git diff --quiet; then
echo "Writing to repo....."
git add .
chmod +x ./scripts/upstreamCommit.sh
./scripts/upstreamCommit.sh $CURR_PURPUR_REF
git push
else
echo "No changes to commit."
fi
env:
CURR_PURPUR_REF: ${{ steps.currPurpurRef.outputs.currPurpurRef }}

View File

@@ -10,42 +10,62 @@ jobs:
build:
runs-on: blacksmith-8vcpu-ubuntu-2204
if: "!contains(github.event.commits[0].message, '[ci-skip]')"
env:
BUILD_NUMBER: ${{ github.run_number }}
outputs:
build_number: ${{ env.BUILD_NUMBER }}
steps:
- name: Setup Action
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Setup Gradle Cache
uses: useblacksmith/cache@v5
with:
add-job-summary: never
generate-job-summary: false
cache-read-only: false
path: |
~/.gradle/caches/modules-2
~/.gradle/caches/jars-*
~/.gradle/caches/transforms-*
~/.gradle/wrapper
~/.gradle/build-cache-*
~/.gradle/configuration-cache-*
.gradle/patchCache
.gradle/patched
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'patches/**/*.patch') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle Cache Cleanup
run: |
mkdir -p ~/.gradle/caches/modules-2
[ -f ~/.gradle/caches/modules-2/modules-2.lock ] && rm -f ~/.gradle/caches/modules-2/modules-2.lock
find ~/.gradle/caches -name "*.lock" -type f -delete || echo "No lock files found"
- name: Setup JDK 21
uses: actions/setup-java@v4
uses: useblacksmith/setup-java@v5
with:
distribution: temurin
java-version: 21
- 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
git config --global user.email "no-reply@github.com"
git config --global user.name "Github Actions"
git config --global core.preloadindex true
git config --global core.fscache true
git config --global gc.auto 256
chmod +x gradlew
- name: Patch
run: ./gradlew applyAllPatches --stacktrace
- name: Apply Patches
run: |
PARALLELISM=$(($(nproc) * 2))
./gradlew applyAllPatches --stacktrace --parallel --max-workers=$PARALLELISM --build-cache --no-daemon
- name: Build Paperclip Jar
run: ./gradlew createMojmapPaperclipJar --stacktrace
run: ./gradlew createMojmapPaperclipJar --stacktrace --parallel --no-daemon
- name: Publish API
continue-on-error: true
run: ./gradlew publish -PdivinemcUsername=${{ secrets.REPO_USERNAME }} -PdivinemcPassword=${{ secrets.REPO_SECRET }}
- name: Get Release Info
- name: Prepare Release Info
run: bash scripts/releaseInfo.sh
env:
BUILD_NUMBER: ${{ env.BUILD_NUMBER }}

View File

@@ -1,37 +1,33 @@
name: DivineMC Test Build
name: Build Pull Request
on:
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
build:
runs-on: blacksmith-8vcpu-ubuntu-2204
steps:
- name: Setup Action
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup JDK 21
uses: actions/setup-java@v4
uses: useblacksmith/setup-java@v5
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"
git config --global user.email "no-reply@github.com"
git config --global user.name "Github Actions"
chmod +x gradlew
- name: Patch
run: ./gradlew applyAllPatches --stacktrace
- name: Apply Patches
run: ./gradlew applyAllPatches --stacktrace --no-daemon
- name: Build Paperclip Jar
run: ./gradlew createMojmapPaperclipJar --stacktrace
run: ./gradlew createMojmapPaperclipJar --stacktrace --no-daemon
- name: Upload Artifacts
uses: actions/upload-artifact@main

44
.github/workflows/publish-api.yml vendored Normal file
View File

@@ -0,0 +1,44 @@
name: Publish API
on:
push:
branches: [ "master" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@main
with:
fetch-depth: 0
- 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"
chmod +x gradlew
- name: Apply patches
run: |
PARALLELISM=$(($(nproc) * 2))
./gradlew applyAllPatches --stacktrace --parallel --max-workers=$PARALLELISM --build-cache --no-daemon
- name: Build
run: ./gradlew build -x test
- name: Publish API
continue-on-error: true
run: |
./gradlew :divinemc-api:publish
./gradlew publishDevBundlePublicationToDivinemcRepository -PpublishDevBundle=true
env:
REPO_USERNAME: ${{ secrets.REPO_USERNAME }}
REPO_PASSWORD: ${{ secrets.REPO_SECRET }}