update to kotlin 2.0.0 #110
Workflow file for this run
This file contains 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 Test and Deploy" | |
on: | |
pull_request_target: | |
paths-ignore: | |
- '*.md' | |
branches: [ main ] | |
types: | |
- closed | |
env: | |
username: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
password: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
jobs: | |
create-staging-repository: | |
if: github.event.pull_request.merged == true | |
name: Create staging repository | |
runs-on: ubuntu-latest | |
outputs: | |
repository_id: ${{ steps.create.outputs.repository_id }} | |
steps: | |
- id: create | |
run: | | |
jsonOutput=$(curl -s --request POST -u "$username:$password" \ | |
--url https://oss.sonatype.org/service/local/staging/profiles/3abaab4608e7e/start \ | |
--header 'Accept: application/json' \ | |
--header 'Content-Type: application/json' \ | |
--data '{ "data": {"description" : "Buffer"} }') | |
stagingRepositoryId=$(echo "$jsonOutput" | jq -r '.data.stagedRepositoryId') | |
if [ -z "$stagingRepositoryId" ]; then | |
echo "Error while creating the staging repository." | |
exit 1 | |
else | |
echo "repository_id=$stagingRepositoryId" >> $GITHUB_OUTPUT | |
fi | |
macos: | |
name: MacOS Build & Upload artifacts to sonatype | |
if: github.event.pull_request.merged == true | |
needs: create-staging-repository | |
runs-on: macOS-latest | |
env: | |
SONATYPE_REPOSITORY_ID: ${{ needs.create-staging-repository.outputs.repository_id }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }} | |
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 19 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '19' | |
cache: gradle | |
- name: Gradle cache | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Setup Chrome | |
uses: browser-actions/setup-chrome@v1 | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
- name: Import GPG Key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.GPG_SECRET }} | |
passphrase: ${{ secrets.GPG_SIGNING_PASSWORD }} | |
- name: Test and deploy with Gradle Major | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'major') }} | |
env: | |
SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }} | |
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
run: ./gradlew publishAllPublicationsToSonatypeRepository -PincrementMajor=true | |
- name: Test and deploy with Gradle Minor | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'minor') }} | |
env: | |
SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }} | |
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
run: ./gradlew publishAllPublicationsToSonatypeRepository -PincrementMinor=true | |
- name: Test and deploy with Gradle Patch | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'major') && !contains(github.event.pull_request.labels.*.name, 'minor') }} | |
env: | |
SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
GPG_SECRET: ${{ secrets.GPG_SECRET }} | |
GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }} | |
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
run: ./gradlew publishAllPublicationsToSonatypeRepository | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Package | |
path: build/libs | |
finalize: | |
runs-on: ubuntu-latest | |
needs: [create-staging-repository, macos] | |
if: ${{ always() && needs.create-staging-repository.result == 'success' && github.event.pull_request.merged == true }} | |
steps: | |
- name: Discard | |
if: ${{ needs.macos.result != 'success' }} | |
uses: nexus-actions/drop-nexus-staging-repo@main | |
with: | |
username: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
password: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
staging_repository_id: ${{ needs.create-staging-repository.outputs.repository-id }} | |
- name: Release | |
if: ${{ needs.macos.result == 'success' }} | |
uses: nexus-actions/release-nexus-staging-repo@main | |
with: | |
username: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
password: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
staging_repository_id: ${{ needs.create-staging-repository.outputs.repository_id }} |