Prepare for release 0.0.1.2 (#7) #4
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*' | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check if tag is on main branch | |
| id: check-branch | |
| run: | | |
| if git branch -r --contains ${{ github.ref }} | grep -q "origin/main"; then | |
| echo "tag_on_main=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "tag_on_main=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Set up JDK | |
| if: steps.check-branch.outputs.tag_on_main == 'true' | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'temurin' | |
| - name: Extract version from tag | |
| if: steps.check-branch.outputs.tag_on_main == 'true' | |
| id: version | |
| run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Publish to Maven Central | |
| if: steps.check-branch.outputs.tag_on_main == 'true' | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_CENTRAL_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_CENTRAL_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SECRET_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_SECRET_PASSPHRASE }} | |
| ORG_GRADLE_PROJECT_VERSION_NAME: ${{ steps.version.outputs.version }} | |
| run: bin/gradle publishToMavenCentral | |
| - name: Build HTML | |
| if: steps.check-branch.outputs.tag_on_main == 'true' | |
| run: bin/gradle dokkaHtml --no-daemon --stacktrace | |
| - name: Upload HTML | |
| if: steps.check-branch.outputs.tag_on_main == 'true' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: lib/build/dokka/html | |
| name: 'github-pages' | |
| - name: Deploy GitHub Pages site | |
| if: steps.check-branch.outputs.tag_on_main == 'true' | |
| uses: actions/deploy-pages@v4 | |
| with: | |
| artifact_name: github-pages |