Files
Shiroha/.github/workflows/publish-api.yml
T
Bacteria ac5e37415a [ci skip]Skip workflows on pull_request events
Add job-level condition in build.yml and publish-api.yml to skip running the build and publish jobs when the GitHub event is a pull_request. This ensures these jobs only run for non-PR events (e.g., push, workflow_dispatch) and avoids executing them for pull request events.
2026-07-09 18:29:27 +08:00

52 lines
1.3 KiB
YAML

name: Publish API
on:
push:
branches:
- "**"
workflow_dispatch:
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
- name: Get Branch Build Number
run: |
BUILD_NUMBER=$(git rev-list --count HEAD)
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: Publish API to Maven
continue-on-error: 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 }}