Delete the redundant '---' separator and the '> 🤖 Automated release by Camellia CI...' line from the release body in .github/workflows/build.yml (removed in two job sections). This cleans up automated release notes output so the run link/footer is no longer appended while keeping artifacts and prerelease behavior unchanged.
198 lines
7.0 KiB
YAML
198 lines
7.0 KiB
YAML
name: Camellia CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
workflow_dispatch:
|
|
inputs:
|
|
force-release:
|
|
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: ""
|
|
comments:
|
|
description: "Add comments to release"
|
|
required: false
|
|
default: ""
|
|
|
|
permissions: write-all
|
|
|
|
jobs:
|
|
build:
|
|
if: github.event_name != 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Git Repository
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: Get Branch Build Number
|
|
run: |
|
|
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"
|
|
|
|
- name: Validate Gradle Wrapper
|
|
uses: gradle/actions/wrapper-validation@v6
|
|
|
|
- name: Set Up JDK
|
|
uses: actions/setup-java@v5
|
|
with:
|
|
distribution: zulu
|
|
java-version: 25
|
|
|
|
- name: Setup Gradle
|
|
uses: gradle/actions/setup-gradle@v6
|
|
with:
|
|
add-job-summary: never
|
|
cache-read-only: false
|
|
|
|
- name: Configure Git User Details
|
|
run: git config --global user.email "ci@monnairealms.moe" && git config --global user.name "Camellia CI"
|
|
|
|
- name: Grant Execute Permission
|
|
run: chmod +x gradlew
|
|
|
|
- name: Apply Patches
|
|
run: ./gradlew applyAllPatches --stacktrace
|
|
|
|
- name: Build
|
|
run: ./gradlew createPaperclipJar --stacktrace
|
|
|
|
- name: Set Environment
|
|
run: sh scripts/SetENV.sh
|
|
|
|
- name: Get Build Info
|
|
id: build-info
|
|
run: |
|
|
BUILD_DATE=$(date -u +'%Y-%m-%d %H:%M:%S UTC')
|
|
echo "build_date=$BUILD_DATE" >> $GITHUB_ENV
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: ${{ env.project_id_b || 'Camellia' }} CI Artifacts
|
|
path: ${{ env.jar_dir }}
|
|
if-no-files-found: warn
|
|
|
|
# ── Release ──
|
|
- name: Check If Release Exists
|
|
if: env.flag_release == 'true'
|
|
run: |
|
|
git fetch --tags
|
|
if [ -n "$(git tag -l "${{ env.tag }}")" ]; then
|
|
echo "Release already exists"
|
|
release_exists=true
|
|
else
|
|
echo "Release does not exist"
|
|
release_exists=false
|
|
fi
|
|
if [ "$release_exists" == "true" ]; then
|
|
counter=1
|
|
while [ -n "$(git tag -l "${{ env.tag }}-${counter}")" ]; do
|
|
counter=$((counter + 1))
|
|
done
|
|
echo "tag=${{ env.tag }}-${counter}" >> $GITHUB_ENV
|
|
echo "release_count= - ${counter}" >> $GITHUB_ENV
|
|
release_exists=false
|
|
fi
|
|
echo "release_exists=${release_exists}" >> $GITHUB_ENV
|
|
|
|
- name: Check If Branch In Expectations
|
|
if: env.flag_release == 'true'
|
|
run: |
|
|
if [[ "$GITHUB_REF_NAME" == ver/* ]] || [[ "$GITHUB_REF_NAME" == exp/* ]] || [[ "$GITHUB_REF_NAME" == dev/* ]]; then
|
|
echo "Branch is in expected prefixes"
|
|
echo "unexpect=false" >> $GITHUB_ENV
|
|
else
|
|
echo "Branch is NOT in expected prefixes"
|
|
echo "unexpect=true" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Create Release - Pre Process
|
|
if: |
|
|
( !( env.unexpect == 'true' )
|
|
&& env.flag_release == 'true'
|
|
&& env.release_exists != 'true'
|
|
&& !(inputs.force-release == 'false')
|
|
) || inputs.force-release == 'true'
|
|
run: |
|
|
if [ "${{ inputs.comments }}" == "" ]; then
|
|
echo "No comments provided"
|
|
echo "flag_comment=false" >> $GITHUB_ENV
|
|
else
|
|
echo "Comments provided: ${{ inputs.comments }}"
|
|
echo "flag_comment=true" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Create Release - No Comment
|
|
if: env.flag_comment == 'false'
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
tag: ${{ env.tag }}
|
|
name: ${{ env.project_id_b }} ${{ env.mcversion }} - ${{ env.commit_id }}${{ env.release_count }}
|
|
body: |
|
|
[](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 }})
|
|
|
|
### ✨ Latest Changes
|
|
${{ env.commit_msg }}
|
|
|
|
|
|
artifacts: ${{ env.jar_dir }}
|
|
generateReleaseNotes: false
|
|
prerelease: ${{ env.pre }}
|
|
makeLatest: ${{ env.make_latest }}
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Create Release - With Comment
|
|
if: env.flag_comment == 'true'
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
tag: ${{ env.tag }}
|
|
name: ${{ env.project_id_b }} ${{ env.mcversion }} - ${{ env.commit_id }}${{ env.release_count }}
|
|
body: |
|
|
[](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 }})
|
|
|
|
### ✨ Latest Changes
|
|
${{ env.commit_msg }}
|
|
|
|
|
|
artifacts: ${{ env.jar_dir }}
|
|
generateReleaseNotes: false
|
|
prerelease: ${{ env.pre }}
|
|
makeLatest: ${{ env.make_latest }}
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
event_file:
|
|
name: "Event File"
|
|
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Upload
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: Event File
|
|
path: ${{ github.event_path }} |