Deploy to Sonatype #74
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: Deploy to Sonatype | |
on: workflow_dispatch | |
permissions: | |
contents: read | |
jobs: | |
test: | |
uses: ./.github/workflows/test.yml | |
build-native: | |
name: Build native lib | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Validate Gradle Wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Set up Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Install cross-compiler | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: sudo apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
- name: Build native lib | |
run: | | |
./gradlew \ | |
-PGITHUB_PUBLISH_TOKEN=${{ secrets.GITHUB_TOKEN }} \ | |
-Ppowersync.binaries.cross-arch=true \ | |
:core:cmakeJvmBuild | |
shell: bash | |
- name: Upload build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-${{ matrix.os }} | |
path: core/build/binaries/desktop/sqlite/ | |
deploy: | |
needs: [test, build-native] | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Validate Gradle Wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.konan | |
key: ${{ runner.os }}-${{ hashFiles('**/.lock') }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Set up Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Download native binaries | |
uses: actions/download-artifact@v4 | |
with: | |
path: core/binaries/desktop | |
merge-multiple: true | |
- name: Display downloaded files | |
run: ls -lR core/binaries/desktop | |
- name: Gradle publish | |
run: | | |
./gradlew \ | |
-PGITHUB_PUBLISH_TOKEN="${{ secrets.GITHUB_TOKEN }}" \ | |
-PsigningInMemoryKey="${{ secrets.SIGNING_KEY }}" \ | |
-PsigningInMemoryKeyId="${{ secrets.SIGNING_KEY_ID }}" \ | |
-PsigningInMemoryKeyPassword="${{ secrets.SIGNING_PASSWORD }}" \ | |
-PcentralPortal.username="${{secrets.SONATYPE_USERNAME}}" \ | |
-PcentralPortal.password="${{secrets.SONATYPE_PASSWORD}}" \ | |
-Ppowersync.binaries.provided="true" \ | |
publishAllPublicationsToSonatypeRepository | |
shell: bash | |
# This will change Package.swift in Github packages to direct to new maven central KMMBridge zip file | |
call-kmmbridge-publish: | |
needs: deploy | |
permissions: | |
contents: write | |
packages: write | |
uses: touchlab/KMMBridgeGithubWorkflow/.github/workflows/[email protected] | |
with: | |
jvmVersion: 17 | |
versionBaseProperty: LIBRARY_VERSION | |
publishTask: kmmBridgePublish | |
secrets: | |
gradle_params: -PsigningInMemoryKey="${{ secrets.SIGNING_KEY }}" -PsigningInMemoryKeyId="${{ secrets.SIGNING_KEY_ID }}" -PsigningInMemoryKeyPassword="${{ secrets.SIGNING_PASSWORD }}" | |