Skip to content

Commit

Permalink
test release (staging to Sonatype)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhachicha committed Feb 22, 2024
1 parent 10cc4aa commit f58b79e
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 2 deletions.
142 changes: 142 additions & 0 deletions .github/workflows/include-deploy-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: Deploy release

on:
workflow_call:
inputs:
version-label:
required: true
type: string

packages-sha-label:
required: true
type: string

jobs:
deploy:
runs-on: macos-latest
name: Deploy release

#TODO release script needs s3cmd
steps:
- name: git checkout
uses: actions/checkout@v3
with:
submodules: "recursive"

- name: Setup Java 11
uses: actions/setup-java@v3
with:
distribution: ${{ vars.VERSION_JAVA_DISTRIBUTION }}
java-version: ${{ vars.VERSION_JAVA }}

- name: Setup Gradle and task/dependency caching
uses: gradle/gradle-build-action@v2
with:
cache-read-only: false

- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: ${{ vars.VERSION_CMAKE }}

- name: Setup ninja
uses: cmelchior/setup-ninja@master
with:
version: ${{ vars.VERSION_NINJA }}

- name: Install ccache
uses: hendrikmuhs/[email protected]
with:
key: 'jvm-package'
max-size: '2.0G'

- name: Prepend ccache executables to the PATH
run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH

# See https://github.com/hendrikmuhs/ccache-action/issues/94
- name: Configure ccache
run: |
ccache --set-config="compiler_check=content"
ccache --show-config
echo '#!/bin/bash\nccache clang "$@"%"' > /usr/local/bin/ccache-clang
echo '#!/bin/bash\nccache clang++ "$@"%"' > /usr/local/bin/ccache-clang++
# TODO This matches 23.2.8568313, but what happens if we a define specific ndk version in our build?
- name: Setup NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: r23c

# We cannot use artifacts as they cannot be shared between workflows, so use cache instead.
- name: Setup build cache
uses: actions/cache@v3
with:
path: ./packages/build/m2-buildrepo
key: packages-m2-jvm-sync-${{ inputs.packages-sha-label }}

- name: Restore Linux JNI lib
uses: actions/download-artifact@v3
with:
name: jni-linux-lib-${{ inputs.version-label }}
path: ./packages/cinterop/build/realmLinuxBuild

- name: Restore Windows JNI lib
uses: actions/download-artifact@v3
with:
name: jni-windows-lib-${{ inputs.version-label }}
path: ./packages/cinterop/build/realmWindowsBuild/Release

- name: Restore MacOS JNI lib
uses: actions/download-artifact@v3
with:
name: jni-macos-lib-${{ inputs.version-label }}
path: ./packages/cinterop/build/realmMacOsBuild

- name: Restore m2-buildrepo
uses: actions/download-artifact@v3
with:
name: all-packages-${{ inputs.version-label }}
path: ./packages/build/m2-buildrepo

# - name: Publish release to Maven Central
# env:
# GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY_BASE_64 }}
# GPG_PASS_PHRASE: ${{ secrets.GPG_PASS_PHRASE }}
# MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }}
# MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
# working-directory: packages
# run: |
# ./gradlew -Prealm.kotlin.targets=iosArm64,iosX64,jvm,macosX64,macosArm64,android,metadata,compilerPlugin,gradlePlugin \
# -Prealm.kotlin.buildRealmCore=false \
# -Prealm.kotlin.copyNativeJvmLibs=linux,windows,macos \
# -Prealm.kotlin.mainHost=true \
# -PsignBuild=true \
# -PsignSecretRingFileKotlin="$GPG_SIGNING_KEY" \
# -PsignPasswordKotlin="$GPG_PASS_PHRASE" \
# -PossrhUsername="$MAVEN_CENTRAL_USER" \
# -PossrhPassword='$MAVEN_CENTRAL_PASSWORD' \
# publishToSonatype

- name: Publish release to Maven Central Legacy
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY_BASE_64 }}
GPG_PASS_PHRASE: ${{ secrets.GPG_PASS_PHRASE }}
MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
REALM_S3_ACCESS_KEY: ${{ secrets.REALM_S3_ACCESS_KEY_BASE }}
REALM_S3_SECRET_KEY: ${{ secrets.REALM_S3_SECRET_KEY }}
DOCS_S3_ACCESS_KEY: ${{ secrets.DOCS_S3_ACCESS_KEY }}
DOCS_S3_SECRET_KEY: ${{ secrets.DOCS_S3_SECRET_KEY }}
SLACK_URL_RELEASE: ${{ secrets.SLACK_URL_RELEASE }}
SLACK_URL_CI: ${{ secrets.SLACK_URL_CI }}
GRADLE_PORTAL_KEY: ${{ secrets.GRADLE_PORTAL_KEY }}
GRADLE_PORTAL_SECRET: ${{ secrets.GRADLE_PORTAL_SECRET }}
run: |
set +x
sh ./tools/publish_release.sh "$MAVEN_CENTRAL_USER" "$MAVEN_CENTRAL_PASSWORD" \
"$REALM_S3_ACCESS_KEY" "$REALM_S3_SECRET_KEY" \
"$DOCS_S3_ACCESS_KEY" "$DOCS_S3_SECRET_KEY" \
"$SLACK_URL_RELEASE" "$SLACK_URL_CI" \
"$GRADLE_PORTAL_KEY" "$GRADLE_PORTAL_SECRET" \
'-PsignBuild=true -PsignSecretRingFileKotlin="$GPG_SIGNING_KEY" -PsignPasswordKotlin=$GPG_PASS_PHRASE'
25 changes: 24 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ jobs:
needs.check-cache.outputs.android-test-sync-apk-cache-hit != 'true')
steps:
- name: Remove unnecessary files
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
Expand Down Expand Up @@ -1649,3 +1649,26 @@ jobs:
secrets: inherit
with:
version-label: ${{ needs.check-cache.outputs.version-label }}


deploy-release:
uses: ./.github/workflows/include-deploy-release.yml
needs: [
check-cache,
static-analysis,
# integration-tests,
# test-jvm-packages,
# test-macos-packages,
# test-ios-packages,
# test-android-packages-emulator,
# test-android-packages-device-farm,
# test-android-packages-device-farm-sync,
package-all-artifacts
]
if: |
always() &&
!cancelled()
secrets: inherit
with:
version-label: ${{ needs.check-cache.outputs.version-label }}
packages-sha-label: ${{ needs.check-cache.outputs.packages-sha }}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ val HOST_OS: OperatingSystem = findHostOs()

object Realm {
val ciBuild = (System.getenv("JENKINS_HOME") != null || System.getenv("CI") != null)
const val version = "1.14.0-SNAPSHOT"
const val version = "0.0.1"
const val group = "io.realm.kotlin"
const val projectUrl = "https://realm.io"
const val pluginPortalId = "io.realm.kotlin"
Expand Down

0 comments on commit f58b79e

Please sign in to comment.