Skip to content

Create a separate job for a release #13

Create a separate job for a release

Create a separate job for a release #13

Workflow file for this run

name: Build and Release Yttrium Kotlin
on:
# workflow_dispatch:
# inputs:
# version:
# description: 'Version to release (e.g. 0.0.1)'
# required: true
push:
env:
CARGO_TERM_COLOR: always
VERSION: ${{ github.event.inputs.version || '0.0.24' }}
TARGET_BRANCH: ${{ github.ref_name }}
permissions:
contents: write # Grant write access to repository contents for this workflow
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
target: [aarch64-linux-android, armv7-linux-androideabi]
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Set up Android SDK
uses: android-actions/setup-android@v3
with:
api-level: 35
build-tools: 35.0.0
ndk-version: 27.2.12479018
- name: Install cargo-ndk
run: |
cargo install cargo-ndk
- name: Build Rust library
run: |
cargo ndk -t ${{ matrix.target }} build --release --features=uniffi/cli
- name: Generate Kotlin bindings
run: |
cargo run --features=uniffi/cli --bin uniffi-bindgen generate --library target/${{ matrix.target }}/release/libuniffi_yttrium.so --language kotlin --out-dir kotlin-bindings
# cargo install uniffi_bindgen
# uniffi-bindgen generate src/your_api.udl --language kotlin --out-dir bindings
- name: Package artifacts
run: |
# Copy the .so files and Kotlin bindings into a single directory
mkdir -p artifacts/libs/${{ matrix.target }}
cp target/${{ matrix.target }}/release/libuniffi_yttrium.so artifacts/libs/${{ matrix.target }}/
cp -r kotlin-bindings artifacts/kotlin-bindings
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts-${{ matrix.target }}
path: artifacts/
release:

Check failure on line 77 in .github/workflows/release-kotlin.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release-kotlin.yml

Invalid workflow file

You have an error in your yaml syntax on line 77
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: artifacts-*
path: downloaded-artifacts
- name: Create artifacts zip
run: |
cd downloaded-artifacts
zip -r artifacts.zip ./*
# - name: Create artifacts zip
# run: |
# zip -r artifacts_${{ matrix.target }}.zip artifacts/
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 0.2.1 # Replace with dynamic version if needed
release_name: Yttrium 0.2.1
draft: false
prerelease: true
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: downloaded-artifacts/artifacts.zip
asset_name: artifacts.zip
asset_content_type: application/zip