# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Stage release to Maven Central

on:
  push:
    branches: [ release ]

jobs:
  release:
    if: github.repository == 'HuaweiCloudDeveloper/gaussdb-quartz'
    runs-on: ubuntu-latest
    environment: gaussdb-quartz-orm-build
    steps:
      - uses: actions/checkout@v4
      - name: Set up JDK 17
        uses: actions/setup-java@v4
        with:
          java-version: 17
          distribution: adopt
      - name: GPG Check
        run: gpg -k
      - name: Release with Maven
        env:
          SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
          SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
          GPG_KEY_BASE64: ${{ secrets.GPG_KEY_BASE64 }}
          GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
        run: ./ci/build-and-deploy-to-maven-central.sh