build: correcting GPG signature #8
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
| # Release build pipeline, operates on `release_*` branches and creates releases | |
| name: CI Release branch | |
| on: | |
| push: | |
| branches: [ "master" ] # trap each push to master branch | |
| paths: # but react only to changes in code or pipeline definition | |
| - pom.xml | |
| - src/**.* | |
| - .github/**.* | |
| jobs: | |
| build: | |
| permissions: | |
| # write permission is required to create a github release | |
| contents: write | |
| # write permission is required for autolabeler | |
| # otherwise, read permission is required at least | |
| pull-requests: write | |
| outputs: | |
| release_id: ${{ steps.create_release.outputs.id }} | |
| released_version: ${{ steps.release_version.outputs.version }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 # checkout sources | |
| with: | |
| ref: ${{ github.ref }} | |
| fetch-depth: 0 | |
| - name: Resolve new release version | |
| id: release_version | |
| uses: codacy/git-version@4be4819f45a11cd0877c05ffe41dace2f8945ff4 | |
| with: | |
| prefix: 'v' | |
| minor-identifier: '/feat(?:\\([^)]+\\))?:/' | |
| - name: Setup Java JDK | |
| uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0 setup JDK 17 for building | |
| with: | |
| java-version: 8 | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| server-id: ossrh | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_CENTRAL_TOKEN | |
| gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
| gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
| - name: Verify GPG setup | |
| run: | | |
| # Import GPG key silently | |
| echo "$MAVEN_GPG_PRIVATE_KEY" | gpg --batch --import --quiet 2>/dev/null | |
| # Test signing silently - redirect all output to /dev/null | |
| echo "test" | gpg --batch --yes \ | |
| --passphrase "$MAVEN_GPG_PASSPHRASE" \ | |
| --pinentry-mode loopback \ | |
| --sign --armor --detach-sign \ | |
| --output /tmp/test.sig \ | |
| --quiet 2>/dev/null | |
| # Check if signing was successful (without showing content) | |
| if [ -f /tmp/test.sig ] && [ -s /tmp/test.sig ]; then | |
| echo "✅ GPG setup verified successfully" | |
| rm -f /tmp/test.sig | |
| else | |
| echo "❌ GPG setup verification failed" | |
| exit 1 | |
| fi | |
| env: | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
| MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
| - name: Build with Maven | |
| run: | | |
| export CURRENT_VERSION="${{ steps.release_version.outputs.version }}" | |
| export NEW_VERSION="$( echo ${CURRENT_VERSION} | sed 's/^v//')" | |
| mvn versions:set -DnewVersion=$NEW_VERSION | |
| mvn -T 1C -B -P release-sign-artifacts -Dmaven.test.skip=true deploy --file pom.xml | |
| env: | |
| DARWIN_BUILD_VERSION: ${{ steps.release_version.outputs.version }} | |
| MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
| MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
| - name: Create distribution directory | |
| run: | | |
| mkdir -p ./dist | |
| cp LICENSE ./dist | |
| cp 'target/babylon-boot.jar' ./dist | |
| - name: Create .zip of dist | |
| uses: thedoctor0/zip-release@b57d897cb5d60cb78b51a507f63fa184cfe35554 # v0.7.6 | |
| with: | |
| type: 'zip' | |
| filename: 'dist.zip' | |
| path: './dist' | |
| - name: Create .tar.gz of dist | |
| uses: thedoctor0/zip-release@b57d897cb5d60cb78b51a507f63fa184cfe35554 # v0.7.6 | |
| with: | |
| type: 'tar' | |
| filename: 'dist.tar.gz' | |
| path: './dist' | |
| - name: Create release | |
| id: create_release | |
| uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6.1.0 | |
| with: | |
| version: ${{ steps.release_version.outputs.version }} | |
| publish: true | |
| - name: Upload dist.zip to release | |
| uses: actions/upload-release-asset@64e5e85fc528f162d7ba7ce2d15a3bb67efb3d80 # v1.0.1 | |
| if: success() | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./dist.zip | |
| asset_name: Dist (zip) | |
| asset_content_type: application/zip | |
| - name: Upload dist.tar.gz to release | |
| uses: actions/upload-release-asset@64e5e85fc528f162d7ba7ce2d15a3bb67efb3d80 # v1.0.1 | |
| if: success() | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./dist.tar.gz | |
| asset_name: Dist (tar.gz) | |
| asset_content_type: application/gzip |