CI: refine build numbering, release/publish flow
Compute BUILD_NUMBER relative to the last gradle.properties mcVersion change (instead of total commits), add dependabot groups for actions and gradle deps, and simplify release notes formatting (disable generated notes and inline metadata). Remove the Publish-To-Repo step from the main build workflow and add a force-push input/conditional to publish-api workflow. Invoke scripts/SetENV.sh in publish-api and update SetENV.sh to produce jar names that omit run attempt suffix for first run. These changes tighten publishing controls and make build numbering reflect per-version increments.
This commit is contained in:
@@ -5,6 +5,10 @@ updates:
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
groups:
|
||||
actions:
|
||||
patterns:
|
||||
- "*"
|
||||
commit-message:
|
||||
prefix: "ci"
|
||||
labels:
|
||||
@@ -16,6 +20,10 @@ updates:
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
groups:
|
||||
gradle-deps:
|
||||
patterns:
|
||||
- "*"
|
||||
commit-message:
|
||||
prefix: "build"
|
||||
labels:
|
||||
|
||||
+21
-30
@@ -10,10 +10,6 @@ on:
|
||||
description: "Force disable release if you enter false, force release if you enter true, default release if not released else skip release"
|
||||
required: false
|
||||
default: ""
|
||||
force-push:
|
||||
description: "Force disable push to repo if you enter false, force push to repo if you enter true, default push if not released else skip push repo"
|
||||
required: false
|
||||
default: ""
|
||||
comments:
|
||||
description: "Add comments to release"
|
||||
required: false
|
||||
@@ -34,7 +30,14 @@ jobs:
|
||||
|
||||
- name: Get Branch Build Number
|
||||
run: |
|
||||
BUILD_NUMBER=$(git rev-list --count HEAD)
|
||||
MC_VERSION=$(grep "^[[:space:]]*mcVersion" gradle.properties | cut -d'=' -f2 | sed 's/^[[:space:]]*//; s/\r//')
|
||||
BASE_COMMIT=$(git log -S "mcVersion=$MC_VERSION" -1 --format="%H" -- gradle.properties)
|
||||
if [ -z "$BASE_COMMIT" ]; then
|
||||
BUILD_NUMBER=$(git rev-list --count HEAD)
|
||||
else
|
||||
BUILD_NUMBER=$(git rev-list --count $BASE_COMMIT..HEAD)
|
||||
BUILD_NUMBER=$((BUILD_NUMBER + 1))
|
||||
fi
|
||||
echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV
|
||||
echo "Branch: $GITHUB_REF_NAME — Build #$BUILD_NUMBER"
|
||||
|
||||
@@ -138,27 +141,21 @@ jobs:
|
||||
tag: ${{ env.tag }}
|
||||
name: ${{ env.project_id_b }} ${{ env.mcversion }} - ${{ env.commit_id }}${{ env.release_count }}
|
||||
body: |
|
||||
# 🌸 Camellia `${{ env.mcversion }}`
|
||||
|
||||
[](https://github.com/${{ github.repository }}/releases/download/${{ env.tag }}/${{ env.jar }})
|
||||
|
||||
### 📝 Build Information
|
||||
* **Build:** `#${{ env.BUILD_NUMBER }}`
|
||||
* **Date:** `${{ env.build_date }}`
|
||||
* **Branch:** [`${{ github.ref_name }}`](https://github.com/${{ github.repository }}/tree/${{ github.ref_name }})
|
||||
* **Commit:** [`${{ env.commit_id }}`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
|
||||
* **Build:** #${{ env.BUILD_NUMBER }}
|
||||
* **Date:** ${{ env.build_date }}
|
||||
* **Branch:** [${{ github.ref_name }}](https://github.com/${{ github.repository }}/tree/${{ github.ref_name }})
|
||||
* **Commit:** [${{ env.commit_id }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
|
||||
|
||||
### ✨ Latest Changes
|
||||
```text
|
||||
${{ env.commit_msg }}
|
||||
```
|
||||
|
||||
---
|
||||
<div align="center">
|
||||
<sub>Automated release by <a href="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}">Camellia CI</a></sub>
|
||||
</div>
|
||||
> 🤖 Automated release by [Camellia CI](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
||||
artifacts: ${{ env.jar_dir }}
|
||||
generateReleaseNotes: true
|
||||
generateReleaseNotes: false
|
||||
prerelease: ${{ env.pre }}
|
||||
makeLatest: ${{ env.make_latest }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -170,29 +167,23 @@ jobs:
|
||||
tag: ${{ env.tag }}
|
||||
name: ${{ env.project_id_b }} ${{ env.mcversion }} - ${{ env.commit_id }}${{ env.release_count }}
|
||||
body: |
|
||||
# 🌸 Camellia `${{ env.mcversion }}`
|
||||
|
||||
[](https://github.com/${{ github.repository }}/releases/download/${{ env.tag }}/${{ env.jar }})
|
||||
|
||||
> **💡 Note:** ${{ inputs.comments }}
|
||||
|
||||
### 📝 Build Information
|
||||
* **Build:** `#${{ env.BUILD_NUMBER }}`
|
||||
* **Date:** `${{ env.build_date }}`
|
||||
* **Branch:** [`${{ github.ref_name }}`](https://github.com/${{ github.repository }}/tree/${{ github.ref_name }})
|
||||
* **Commit:** [`${{ env.commit_id }}`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
|
||||
* **Build:** #${{ env.BUILD_NUMBER }}
|
||||
* **Date:** ${{ env.build_date }}
|
||||
* **Branch:** [${{ github.ref_name }}](https://github.com/${{ github.repository }}/tree/${{ github.ref_name }})
|
||||
* **Commit:** [${{ env.commit_id }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
|
||||
|
||||
### ✨ Latest Changes
|
||||
```text
|
||||
${{ env.commit_msg }}
|
||||
```
|
||||
|
||||
---
|
||||
<div align="center">
|
||||
<sub>Automated release by <a href="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}">Camellia CI</a></sub>
|
||||
</div>
|
||||
> 🤖 Automated release by [Camellia CI](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
||||
artifacts: ${{ env.jar_dir }}
|
||||
generateReleaseNotes: true
|
||||
generateReleaseNotes: false
|
||||
prerelease: ${{ env.pre }}
|
||||
makeLatest: ${{ env.make_latest }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -206,4 +197,4 @@ jobs:
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: Event File
|
||||
path: ${{ github.event_path }}
|
||||
path: ${{ github.event_path }}
|
||||
@@ -5,6 +5,11 @@ on:
|
||||
branches:
|
||||
- "**"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
force-push:
|
||||
description: "Force disable push to repo if you enter false, force push to repo if you enter true, default push if not released else skip push repo"
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
@@ -19,7 +24,14 @@ jobs:
|
||||
|
||||
- name: Get Branch Build Number
|
||||
run: |
|
||||
BUILD_NUMBER=$(git rev-list --count HEAD)
|
||||
MC_VERSION=$(grep "^[[:space:]]*mcVersion" gradle.properties | cut -d'=' -f2 | sed 's/^[[:space:]]*//; s/\r//')
|
||||
BASE_COMMIT=$(git log -S "mcVersion=$MC_VERSION" -1 --format="%H" -- gradle.properties)
|
||||
if [ -z "$BASE_COMMIT" ]; then
|
||||
BUILD_NUMBER=$(git rev-list --count HEAD)
|
||||
else
|
||||
BUILD_NUMBER=$(git rev-list --count $BASE_COMMIT..HEAD)
|
||||
BUILD_NUMBER=$((BUILD_NUMBER + 1))
|
||||
fi
|
||||
echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV
|
||||
|
||||
- name: Set Up JDK
|
||||
@@ -42,8 +54,12 @@ jobs:
|
||||
- name: Apply Patches
|
||||
run: ./gradlew applyAllPatches --stacktrace
|
||||
|
||||
- name: Set Environment
|
||||
run: sh scripts/SetENV.sh
|
||||
|
||||
- name: Publish API to Maven
|
||||
continue-on-error: true
|
||||
if: |
|
||||
( env.flag_push_repo == 'true' && !(inputs.force-push == 'false') ) || inputs.force-push == 'true'
|
||||
run: |
|
||||
./gradlew :camellia-api:publish
|
||||
./gradlew generateDevelopmentBundle publishDevBundlePublicationToBacteriawaRepository -PpublishDevBundle=true
|
||||
|
||||
+5
-1
@@ -15,7 +15,11 @@ release=$(prop release)
|
||||
pushRepo=$(prop pushRepo)
|
||||
release_tag="$mcversion-$commitid"
|
||||
run_attempt="${GITHUB_RUN_ATTEMPT:-1}"
|
||||
jarName="$project_id-$mcversion-$BUILD_NUMBER-$run_attempt.jar"
|
||||
if [ "$run_attempt" = "1" ]; then
|
||||
jarName="$project_id-$mcversion-$BUILD_NUMBER.jar"
|
||||
else
|
||||
jarName="$project_id-$mcversion-$BUILD_NUMBER-$run_attempt.jar"
|
||||
fi
|
||||
jarName_dir="camellia-server/build/libs/$jarName"
|
||||
|
||||
flag_push_repo=false
|
||||
|
||||
Reference in New Issue
Block a user