Publish #2
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 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| close_staging_repository: | |
| description: Close and release the Sonatype staging repository | |
| required: true | |
| default: false | |
| type: boolean | |
| publish_docs: | |
| description: Publish Dokka docs over SSH | |
| required: true | |
| default: true | |
| type: boolean | |
| release_version: | |
| description: Release version, for example 1.0.0 | |
| required: true | |
| type: string | |
| next_version: | |
| description: Next development version, for example 1.0.1-SNAPSHOT | |
| required: true | |
| type: string | |
| concurrency: | |
| group: publish-${{ github.ref }} | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| publish: | |
| name: Publish artifacts | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 90 | |
| env: | |
| ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} | |
| ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_SIGNING_KEY_ID }} | |
| ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SIGNING_KEY }} | |
| ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SIGNING_PASSWORD }} | |
| DOKKA_REPO: ${{ secrets.DOKKA_REPO }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 25 | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| with: | |
| cache-read-only: false | |
| cache-cleanup: on-success | |
| - name: Cache local Maven repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-m2-v1-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', '**/gradle-wrapper.properties', 'gradle/*.versions.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-m2-v1- | |
| - name: Configure Git identity | |
| run: | | |
| git config user.name "Kirill Gagarski" | |
| git config user.email "kirill.gagarski@gmail.com" | |
| - name: Validate release branch | |
| if: ${{ github.ref_name != 'revive-2026-07' }} | |
| run: | | |
| echo "Releases must be run from revive-2026-07; current ref is ${{ github.ref_name }}." | |
| exit 1 | |
| - name: Set up SSH for docs | |
| if: ${{ inputs.publish_docs }} | |
| uses: webfactory/ssh-agent@v0.9.0 | |
| with: | |
| ssh-private-key: ${{ secrets.DOKKA_SSH_PRIVATE_KEY }} | |
| - name: Configure SSH known hosts | |
| if: ${{ inputs.publish_docs }} | |
| shell: bash | |
| env: | |
| DOKKA_KNOWN_HOSTS: ${{ secrets.DOKKA_KNOWN_HOSTS }} | |
| run: | | |
| mkdir -p ~/.ssh | |
| chmod 700 ~/.ssh | |
| if [ -n "$DOKKA_KNOWN_HOSTS" ]; then | |
| printf '%s\n' "$DOKKA_KNOWN_HOSTS" > ~/.ssh/known_hosts | |
| chmod 600 ~/.ssh/known_hosts | |
| fi | |
| - name: Release, publish artifacts, and optionally publish docs | |
| run: >- | |
| ./gradlew --build-cache release | |
| -Prelease.useAutomaticVersion=true | |
| -Prelease.releaseVersion="${{ inputs.release_version }}" | |
| -Prelease.newVersion="${{ inputs.next_version }}" | |
| -Pvertigram.staging.close="${{ inputs.close_staging_repository }}" | |
| -Pvertigram.dokka.publish="${{ inputs.publish_docs }}" | |
| -Pvertigram.dokka.repo="$DOKKA_REPO" |