# Copyright 2021 Collate # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. name: Publish Package to Maven Central Repository on: workflow_dispatch: push: branches: - main paths: - "openmetadata-service/**" - "openmetadata-spec/src/main/resources/json/schema/**" - "openmetadata-clients/**" - "pom.xml" - ".github/workflows/publish-maven-package.yml" permissions: contents: read jobs: publish-maven-packages: runs-on: ubuntu-latest environment: publish steps: - name: Free Disk Space (Ubuntu) uses: jlumbroso/free-disk-space@main with: tool-cache: false android: true dotnet: true haskell: true large-packages: false swap-storage: true - uses: actions/checkout@v4 - name: Set up JDK 21 uses: actions/setup-java@v4 with: java-version: 21 distribution: "temurin" server-id: central server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} gpg-passphrase: MAVEN_GPG_PASSPHRASE - name: Install Ubuntu dependencies run: | sudo apt-get update sudo apt-get install -y unixodbc-dev python3-venv librdkafka-dev gcc libsasl2-dev build-essential libssl-dev libffi-dev \ librdkafka-dev unixodbc-dev libevent-dev - name: Setup Test Containers Properties run: | sudo make install_antlr_cli echo 'testcontainers.reuse.enable=true' >> $HOME/.testcontainers.properties - name: Setup settings-security.xml run: | rm -rf ~/.m2/settings-security.xml echo "${{ secrets.MAVEN_MASTER_PASSWORD }}" > ~/.m2/settings-security.xml - name: Install gpg secret key run: | cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import gpg --list-secret-keys --keyid-format LONG - name: Publish to Central Repository env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} run: | mvn \ --no-transfer-progress \ --batch-mode \ -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \ -DskipTests -Prelease clean deploy