Skip to content

Fix HybridQueryRanker commonMain compile for v0.5.0 publish (#479) #12

Fix HybridQueryRanker commonMain compile for v0.5.0 publish (#479)

Fix HybridQueryRanker commonMain compile for v0.5.0 publish (#479) #12

Workflow file for this run

name: Publish to Maven Central
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run (skip actual publish)'
required: false
default: 'false'
type: boolean
permissions:
contents: write
jobs:
publish:
name: Publish to Maven Central
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate tag version
if: startsWith(github.ref, 'refs/tags/v')
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
GRADLE_VERSION=$(grep "ampereVersion=" gradle.properties | cut -d'=' -f2)
if [ "$TAG_VERSION" != "$GRADLE_VERSION" ]; then
echo "Error: Tag version ($TAG_VERSION) does not match gradle.properties ($GRADLE_VERSION)"
exit 1
fi
echo "Version validated: $TAG_VERSION"
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Create local.properties
run: |
cat > local.properties << 'EOF'
anthropic_api_key=placeholder
google_api_key=placeholder
openai_api_key=placeholder
EOF
- name: Run ktlint before publish
timeout-minutes: 10
run: ./gradlew ktlintCheck
- name: Run tests before publish
timeout-minutes: 10
run: ./gradlew :ampere-core:jvmTest
- name: Decode signing key
env:
SIGNING_KEY_BASE64: ${{ secrets.SIGNING_KEY }}
run: echo "$SIGNING_KEY_BASE64" | base64 -d > /tmp/signing-key.asc
- name: Publish to Maven Central
if: ${{ github.event.inputs.dry_run != 'true' }}
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
run: |
export ORG_GRADLE_PROJECT_signingInMemoryKey="$(cat /tmp/signing-key.asc)"
./gradlew :ampere-core:publishAllPublicationsToMavenCentralRepository
- name: Dry run publish
if: ${{ github.event.inputs.dry_run == 'true' }}
run: |
echo "Dry run mode - skipping actual publish"
./gradlew :ampere-core:publishAllPublicationsToMavenCentralRepository --dry-run
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/v') && github.event.inputs.dry_run != 'true'
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}