Files
Shiroha/.github/workflows/publish-api.yml
T
Bacteria 5ce33501cd 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.
2026-07-09 20:18:43 +08:00

69 lines
2.1 KiB
YAML

name: Publish API
on:
push:
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:
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
- name: Set Up JDK
uses: actions/setup-java@v5
with:
distribution: zulu
java-version: 25
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- 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: Set Environment
run: sh scripts/SetENV.sh
- name: Publish API to Maven
if: |
( env.flag_push_repo == 'true' && !(inputs.force-push == 'false') ) || inputs.force-push == 'true'
run: |
./gradlew :camellia-api:publish
./gradlew generateDevelopmentBundle publishDevBundlePublicationToBacteriawaRepository -PpublishDevBundle=true
env:
MAVEN_REPO_PASSWORD: ${{ secrets.MAVEN_REPO_PASSWORD }}
MAVEN_REPO_USERNAME: ${{ secrets.MAVEN_REPO_USERNAME }}