Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions .github/workflows/publish-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ on:
version:
description: "Version/tag to publish (e.g., v0.7.0-rc.50 or 0.7.0-rc.50)"
required: true
dry_run:
description: "Build and upload CI artifacts without publishing"
type: boolean
required: false
default: false

jobs:
publish:
Expand All @@ -24,14 +29,21 @@ jobs:
- name: Normalize release version
id: version
shell: bash
env:
INPUT_VERSION: ${{ inputs.version || github.event.release.tag_name || github.ref_name }}
run: |
VERSION="${{ github.event.inputs.version || github.event.release.tag_name || github.ref_name }}"
TAG="$VERSION"
if [[ ! "$INPUT_VERSION" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then
echo "Invalid release version/tag" >&2
exit 1
fi
TAG="$INPUT_VERSION"
if [[ "$TAG" != v* ]]; then
TAG="v$TAG"
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
echo "RELEASE_TAG=$TAG" >> "$GITHUB_ENV"
echo "RELEASE_VERSION=${TAG#v}" >> "$GITHUB_ENV"

- uses: actions/checkout@v4
with:
Expand All @@ -52,6 +64,8 @@ jobs:

- name: Set up Android SDK
uses: android-actions/setup-android@v3
with:
packages: platform-tools

- name: Set up Android NDK
id: setup-ndk
Expand All @@ -73,7 +87,7 @@ jobs:

- name: Build with Gradle
working-directory: bindings/kotlin/ldk-node-android
run: ./gradlew build -Pversion=${{ steps.version.outputs.version }}
run: ./gradlew build "-Pversion=$RELEASE_VERSION"

- name: Upload native debug symbols artifact
uses: actions/upload-artifact@v4
Expand All @@ -82,14 +96,16 @@ jobs:
path: bindings/kotlin/ldk-node-android/native-debug-symbols.zip

- name: Upload native debug symbols to release
if: ${{ !inputs.dry_run }}
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "${{ steps.version.outputs.tag }}" bindings/kotlin/ldk-node-android/native-debug-symbols.zip --clobber
run: gh release upload "$RELEASE_TAG" bindings/kotlin/ldk-node-android/native-debug-symbols.zip --clobber

- name: Publish to GitHub Packages
if: ${{ !inputs.dry_run }}
working-directory: bindings/kotlin/ldk-node-android
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPO: ${{ github.repository }}
run: ./gradlew publish -Pversion=${{ steps.version.outputs.version }}
run: ./gradlew publish "-Pversion=$RELEASE_VERSION"
Loading