[Automated] Code formatting with Spotless #10
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: Build and Publish | |
| on: | |
| push: | |
| pull_request: | |
| release: | |
| types: [published] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| pages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: 'gradle' | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| export VERSION="" | |
| if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
| export VERSION=${GITHUB_REF#refs/tags/} | |
| echo "Publishing release $VERSION" | |
| else | |
| echo "Publishing snapshot" | |
| fi | |
| export GITHUB_REGISTRY=${{ github.repository }} | |
| export GITHUB_USERNAME=${{ github.actor }} | |
| export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
| ./gradlew --no-daemon build javadoc | |
| - name: Publish Snapshot | |
| if: github.event_name != 'pull_request' && github.event_name != 'release' | |
| env: | |
| SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
| SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
| GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| run: | | |
| ./gradlew --no-daemon publishAllPublicationsToDistFolder publishToSonatype --info | |
| - name: Publish Release | |
| if: github.event_name != 'pull_request' && github.event_name == 'release' | |
| env: | |
| SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
| SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
| GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| run: | | |
| export VERSION="" | |
| if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
| export VERSION=${GITHUB_REF#refs/tags/} | |
| echo "Publishing release $VERSION" | |
| fi | |
| ./gradlew --no-daemon publishAllPublicationsToDistFolder publishToSonatype closeAndReleaseSonatypeStagingRepository --info | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: dist | |
| - name: Upload pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: 'dist/javadoc/lnurl4j' | |
| - name: Deploy to GitHub Pages | |
| if: github.event_name == 'release' | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |