Merge pull request #353 from tcheeric/dependabot/maven/org.codehaus.m… #343
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: Release | ||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Set up JDK 21 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '21' | ||
| cache: 'maven' | ||
| server-id: github | ||
| server-username: ${{ github.actor }} | ||
| server-password: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Import GPG key | ||
| env: | ||
| GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
| run: | | ||
| echo "$GPG_PRIVATE_KEY" | gpg --batch --import | ||
| gpg --list-secret-keys --keyid-format LONG | ||
| - name: Build and deploy | ||
| env: | ||
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
| run: ./mvnw -q -P release deploy -Dgpg.passphrase="$GPG_PASSPHRASE" | ||
| - name: Deploy to GitHub Packages | ||
| env: | ||
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
| run: | | ||
| ./mvnw -q -P release deploy -Dgpg.passphrase="$GPG_PASSPHRASE" \ | ||
| -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/tcheeric/nostr-java | ||
| - name: Collect JAR artifacts | ||
| run: | | ||
| mkdir -p release-jars | ||
| find . -name "*.jar" -path "*/target/*.jar" -not -name "*sources*" -not -name "*javadoc*" -exec cp {} release-jars/ \; | ||
| if ! ls release-jars/*.jar 1> /dev/null 2>&1; then | ||
| echo "Error: No JAR files found to upload." | ||
| exit 1 | ||
| fi | ||
| - name: Create GitHub release | ||
| id: create_release | ||
| uses: actions/create-release@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| tag_name: ${{ github.ref }} | ||
| release_name: ${{ github.ref_name }} | ||
| draft: false | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| gh release create "${{ github.ref_name }}" \ | ||
| --title "${{ github.ref }}" \ | ||
| --notes "" \ | ||
| --verify-tag \ | ||
| --latest | ||
| - name: Upload JAR artifacts | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| for file in release-jars/*.jar; do | ||
| gh release upload "${{ github.ref_name }}" "$file" --clobber | ||
| done | ||