Files
Shiroha/.github/workflows/build-pr.yml
T
Bacteria 3082c3f1d1 Add CI workflows, dependabot and env script
Introduce CI infrastructure: add Dependabot config to update GitHub Actions and Gradle dependencies weekly; add build-pr workflow to run PR builds, create the paperclip JAR, and upload artifacts; add full Camellia CI workflow to build, set environment, upload artifacts, optionally publish to Maven and create GitHub releases (with release notes and prerelease handling); add publish-api workflow to publish the API artifact. Also add scripts/SetENV.sh which reads gradle.properties, computes build/release flags, renames the paperclip jar and exports environment variables for the workflows. These changes set up automated builds, dependency maintenance, publishing and release automation for the project.
2026-07-09 18:22:49 +08:00

58 lines
1.6 KiB
YAML

name: Build Pull Request
on:
pull_request:
branches:
- "**"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Git Repository
uses: actions/checkout@v7
- 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: true
- name: Configure Git User Details
run: |
git config --global user.email "ci-test@monnairealms.moe"
git config --global user.name "Camellia Test CI"
- name: Grant Execute Permission
run: chmod +x gradlew
- name: Apply Patches
run: ./gradlew applyAllPatches --stacktrace
- name: Build
run: ./gradlew createPaperclipJar --stacktrace
- name: Rename Artifact
run: |
prop() {
awk -F= -v key="$1" '$1 == key { val = $2; sub(/[[:space:]]*#.*$/, "", val); gsub(/^[[:space:]]+|[[:space:]]+$/, "", val); print val }' gradle.properties
}
jarName="camellia-$(prop mcVersion).jar"
mv camellia-server/build/libs/camellia-paperclip-"$(prop version)"*.jar "$jarName" 2>/dev/null || \
mv camellia-server/build/libs/*-paperclip-*.jar "$jarName" 2>/dev/null || true
echo "jar=$jarName" >> "$GITHUB_ENV"
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: ${{ env.jar || 'camellia-pr' }}
path: ${{ env.jar || 'camellia-server/build/libs/*-paperclip-*.jar' }}
if-no-files-found: warn