Skip to content

Commit 88492d2

Browse files
authored
update release flow (#189)
1 parent 815c131 commit 88492d2

3 files changed

Lines changed: 24 additions & 15 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
ref: ${{ inputs.commit || 'main' }}
2929

3030
version-and-tag:
31-
needs: [ get-configs, validate ]
31+
needs: [ get-configs ]
3232
runs-on: ubuntu-latest
3333
permissions:
3434
contents: write
@@ -330,8 +330,10 @@ jobs:
330330
env:
331331
ORG_GRADLE_PROJECT_signingKey: ${{ steps.signing-secrets.outputs.signing_key }}
332332
ORG_GRADLE_PROJECT_signingPassword: ${{ steps.signing-secrets.outputs.signing_password }}
333+
RELEASE_TAG: ${{ inputs.tag }}
333334
run: |
334335
set -euo pipefail
336+
./generate-version-properties.sh "$RELEASE_TAG"
335337
gradle --no-daemon --console=plain centralBundle
336338
ls -lh build/central/
337339

src/bindings-jvm/build.sh

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ GENERATED_DIR="$SCRIPT_DIR/generated"
1515
RELEASE_DIR="$WORKSPACE/target/release"
1616
KOTLIN_SRC="$SCRIPT_DIR/src/main/kotlin"
1717

18-
JNA_VERSION="5.19.1"
19-
GSON_VERSION="2.14.0"
20-
2118
ARCH="$(uname -m)"
2219
# Normalize to JNA's resource-prefix arch tokens (its canonical form)
2320
case "$ARCH" in
@@ -94,17 +91,9 @@ mkdir -p "$NATIVES_DIR"
9491
cp "$RELEASE_DIR/$LIB_NAME" "$NATIVES_DIR/"
9592

9693
# ── Generate version.properties ────────────────────────────────────────────────
97-
# Cargo.toml is the single source of truth for the version; JNA/Gson versions are
98-
# owned here. The Gradle build reads these (build.gradle.kts) for the coordinates and
99-
# POM dependency versions, so nothing is hardcoded and versions cannot drift.
100-
VERSION=$(grep '^version' "$WORKSPACE/Cargo.toml" | head -1 | sed 's/.*"\(.*\)".*/\1/')
101-
echo "Generating version.properties (version ${VERSION})..."
102-
cat > "$SCRIPT_DIR/version.properties" <<EOF
103-
# Generated by build.sh — do not edit manually. Version from Cargo.toml; dep versions from build.sh.
104-
publishVersion=${VERSION}
105-
jnaVersion=${JNA_VERSION}
106-
gsonVersion=${GSON_VERSION}
107-
EOF
94+
"$SCRIPT_DIR/generate-version-properties.sh"
95+
JNA_VERSION=$(grep '^jnaVersion=' "$SCRIPT_DIR/version.properties" | cut -d= -f2)
96+
GSON_VERSION=$(grep '^gsonVersion=' "$SCRIPT_DIR/version.properties" | cut -d= -f2)
10897

10998
# ── Compile + package JAR via Gradle ───────────────────────────────────────────
11099
# Gradle compiles the generated Kotlin (resolving JNA/Gson), bundles the .kt sources,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
# Usage: generate-version-properties.sh [publish-version] (defaults to the Cargo.toml version)
3+
set -euo pipefail
4+
5+
VERSION_PROPERTIES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
7+
JNA_VERSION="5.19.1"
8+
GSON_VERSION="2.14.0"
9+
10+
VERSION="${1:-$(grep '^version' "$VERSION_PROPERTIES_DIR/../Cargo.toml" | head -1 | sed 's/.*"\(.*\)".*/\1/')}"
11+
12+
echo "Generating version.properties (version ${VERSION})..."
13+
cat > "$VERSION_PROPERTIES_DIR/version.properties" <<EOF
14+
# Generated by generate-version-properties.sh — do not edit manually.
15+
publishVersion=${VERSION}
16+
jnaVersion=${JNA_VERSION}
17+
gsonVersion=${GSON_VERSION}
18+
EOF

0 commit comments

Comments
 (0)