build: make gradlew executable #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
build-rust: | |
name: Build Binaries | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- build: linux-x86 | |
os: ubuntu-latest | |
target: i686-unknown-linux-gnu | |
- build: linux-x86_64 | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- build: linux-aarch64 | |
os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
- build: win-x86 | |
os: windows-latest | |
target: i686-pc-windows-msvc | |
- build: win-x86_64 | |
os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- build: mac-x86_64 | |
os: macos-11 | |
target: x86_64-apple-darwin | |
- build: mac-aarch64 | |
os: macos-11 | |
target: aarch64-apple-darwin | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
- name: Get the release version from the tag | |
shell: bash | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
targets: ${{ matrix.target }} | |
- name: Install gcc-aarch64-linux-gnu | |
if: matrix.build == 'linux-aarch64' | |
run: sudo apt-get update && sudo apt-get install gcc-aarch64-linux-gnu -y | |
- name: Install gcc-i686-linux-gnu | |
if: matrix.build == 'linux-x86' | |
run: sudo apt-get update && sudo apt-get install gcc-i686-linux-gnu libc6-dev-i386 -y | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
env: | |
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
with: | |
command: build | |
args: --release --target ${{ matrix.target }} --manifest-path rust/Cargo.toml | |
- name: Create platform dir | |
shell: bash | |
run: | | |
binary_name="vad_jni_rust" | |
dirname="src/main/resources/natives/${{ matrix.build }}" | |
mkdir "$dirname" | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
mv "rust/target/${{ matrix.target }}/release/$binary_name.dll" "$dirname" | |
elif [ "${{ matrix.os }}" = "macos-11" ]; then | |
mv "rust/target/${{ matrix.target }}/release/lib$binary_name.dylib" "$dirname" | |
else | |
mv "rust/target/${{ matrix.target }}/release/lib$binary_name.so" "$dirname" | |
fi | |
echo "ASSET=$dirname" >> $GITHUB_ENV | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.build }} | |
path: ${{ env.ASSET }} | |
build: | |
name: Build & Publish Jar | |
runs-on: ubuntu-latest | |
needs: build-rust | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: src/main/resources/natives | |
- name: Get the release version from the tag | |
shell: bash | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
with: | |
arguments: publish -x test -Pversion=${{ env.VERSION }} | |
- name: Upload artifact | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
build/libs/vad-jni-rust-${{ env.VERSION }}.jar |