-
Notifications
You must be signed in to change notification settings - Fork 17
86 lines (74 loc) · 3.93 KB
/
Copy pathrelease.yml
File metadata and controls
86 lines (74 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Publish release
on:
workflow_call:
jobs:
# Cross-compile the Rust shared-core for every supported platform. Each job uploads its library
# already laid out as dev/restate/sdk/core/native/<classifier>/librestate_sdk_core.<ext>, so the
# publish job below can reassemble the full tree and overlay it into the sdk-core uber jar. This
# runs for both snapshots (push to main) and tagged releases.
build-native:
if: github.repository == 'restatedev/sdk-java'
uses: ./.github/workflows/native.yaml
publish:
if: github.repository == 'restatedev/sdk-java'
needs: build-native
name: Publish
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
java-version: '25'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
# cargoBuild still runs during packaging to emit the C header jextract needs to compile the
# FFM overlay; the host .so it produces is discarded because every platform library (including
# linux-x86_64) is supplied by the overlay downloaded below.
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-workspaces: sdk-core/src/main/rust
# Reassemble the cross-compiled libraries into a single dev/restate/sdk/core/native/<classifier>
# tree. `merge-multiple` overlays every native-* artifact into the same directory.
- name: Download cross-compiled native libraries
uses: actions/download-artifact@v8
with:
pattern: native-*
path: native-libs
merge-multiple: true
- name: Show downloaded native libraries
run: find native-libs -type f | sort
# Retrieve the version of the SDK
- name: Install dasel
run: curl -sSLf "$(curl -sSLf https://api.github.com/repos/tomwright/dasel/releases/latest | grep browser_download_url | grep linux_amd64 | grep -v .gz | cut -d\" -f 4)" -L -o dasel && chmod +x dasel && mv ./dasel /usr/local/bin/dasel
- name: Parse published sdk version
run: |
echo "PUBLISHED_SDK_VERSION=$(cat gradle/libs.versions.toml | dasel -i toml versions.restate -o yaml)" >> "$GITHUB_ENV"
# Dry run — builds the uber jar with the multi-platform overlay and checks signing.
- name: Publish dry-run
env:
# Used for checking the signing
MAVEN_CENTRAL_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }}
MAVEN_CENTRAL_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}
run: ./gradlew -PnativeLibsDir="${{ github.workspace }}/native-libs" publishToMavenLocal
# Fail the release if any platform's native library is missing from the staged jar.
- name: Verify native libraries are bundled
run: ./gradlew -PnativeLibsDir="${{ github.workspace }}/native-libs" :sdk-core:verifyNativeLibs
- name: Publish to staging area on Maven Central
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_CENTRAL_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }}
MAVEN_CENTRAL_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}
run: ./gradlew -PnativeLibsDir="${{ github.workspace }}/native-libs" publishToSonatype
- name: Release staging area
if: "!contains(env.PUBLISHED_SDK_VERSION, '-SNAPSHOT')"
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_CENTRAL_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }}
MAVEN_CENTRAL_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }}
run: ./gradlew findSonatypeStagingRepository closeAndReleaseSonatypeStagingRepository