Update maven-central-publish.yml #8
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to Maven Central | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '11' | |
| cache: 'gradle' | |
| - name: Import GPG key | |
| run: | | |
| echo "$GPG_PRIVATE_KEY" | gpg --batch --import | |
| env: | |
| GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| - name: Build and publish to local Maven repo | |
| env: | |
| ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} | |
| ORG_GRADLE_PROJECT_signingPassphrase: ${{ secrets.GPG_PASSPHRASE }} | |
| run: ./gradlew clean build publishToMavenLocal | |
| - name: List build outputs | |
| run: | | |
| find build -type f | |
| find ~/.m2/repository/io/fastpix/sdk/0.1.0 -type f || true | |
| - name: Prepare artifacts for upload | |
| run: | | |
| mkdir -p upload | |
| cp ~/.m2/repository/io/fastpix/sdk/0.1.0/sdk-0.1.0.jar upload/ | |
| cp ~/.m2/repository/io/fastpix/sdk/0.1.0/sdk-0.1.0.pom upload/ | |
| cp ~/.m2/repository/io/fastpix/sdk/0.1.0/sdk-0.1.0-sources.jar upload/ || true | |
| cp ~/.m2/repository/io/fastpix/sdk/0.1.0/sdk-0.1.0-javadoc.jar upload/ || true | |
| - name: Upload to Central Publishing Portal | |
| env: | |
| CPP_USER_TOKEN_USERNAME: ${{ secrets.CPP_USER_TOKEN_USERNAME }} | |
| CPP_USER_TOKEN_PASSWORD: ${{ secrets.CPP_USER_TOKEN_PASSWORD }} | |
| run: | | |
| curl -u "$CPP_USER_TOKEN_USERNAME:$CPP_USER_TOKEN_PASSWORD" \ | |
| -F "file=@upload/sdk-0.1.0.jar" \ | |
| -F "file=@upload/sdk-0.1.0.pom" \ | |
| -F "file=@upload/sdk-0.1.0-sources.jar" \ | |
| -F "file=@upload/sdk-0.1.0-javadoc.jar" \ | |
| https://central.sonatype.com/api/v1/publish |