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 }}