Skip to content

Commit

Permalink
Update workflow to publish jars
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Dec 10, 2023
1 parent c2ad2c6 commit 01e0f78
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
32 changes: 18 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
include:
- os: ubuntu-22.04
arch-name: linuxx86-64
lib-src: cmake_build/libmrcal_jni.so
lib-dst: cmake_build/libmrcal_jni_linuxx86-64.so

runs-on: ${{ matrix.os }}
name: "mrcal-jni - Build - ${{ matrix.arch-name }}"
Expand Down Expand Up @@ -53,14 +51,21 @@ jobs:
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/cmake_build --config ${{env.BUILD_TYPE}} ${{ (startsWith(matrix.arch-name, 'windowx86-64') && '--config Release') || '' }} -j --target mrcal_jni

- name: Rename artifact
run: mv ${{ matrix.lib-src }} ${{ matrix.lib-dst }}
- name: Gradle build
# Build your program with the given configuration
run: ./gradlew build

- run: ./gradlew publish
name: Publish
env:
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
if: github.event_name == 'push'

- uses: actions/upload-artifact@master
with:
name: libmrcal-jni-${{ matrix.arch-name }}
name: libmrcal-jar-${{ matrix.arch-name }}
path: |
${{ matrix.lib-dst }}
${{ github.workspace }}/build/libs/*.jar
build-raspi:
runs-on: ubuntu-latest
Expand All @@ -81,13 +86,13 @@ jobs:
sudo apt install cmake default-jdk git gcc g++ libmrcal-dev mrbuild libsuitesparse-dev liblist-moreutils-perl -y
cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DOPENCV_ARCH=linuxarm64
cmake --build build --config ${{env.BUILD_TYPE}} -j --target mrcal_jni
mv cmake_build/libmrcal_jni.so cmake_build/libmrcal_jni_aarch64.so
ARTIFACTORY_API_KEY=${{ secrets.ARTIFACTORY_API_KEY }} ./gradlew build ${{ (startsWith(github.event_name, 'push') && 'publish') || '' }}
- uses: actions/upload-artifact@v3
name: Upload shared library
name: Upload jar
with:
name: libmrcal-jni-pi
path: cmake_build/libmrcal_jni_aarch64.so
name: libmrcal-jar-pi
path: ${{ github.workspace }}/build/libs/*.jar

build-windows:
runs-on: windows-latest
Expand Down Expand Up @@ -127,7 +132,7 @@ jobs:

- name: Gradle build
# Build your program with the given configuration
run: ./gradlew copyNativeLibrary build
run: ./gradlew build

- run: ./gradlew publish
name: Publish
Expand All @@ -137,9 +142,8 @@ jobs:

- uses: actions/upload-artifact@master
with:
name: libmrcal-jni-windowsx64
path: |
cmake_build/bin/**/*.dll
name: libmrcal-jar-windowsx64
path: ${{ github.workspace }}/build/libs/*.jar

release:
needs: [build-host, build-raspi]
Expand Down
1 change: 1 addition & 0 deletions publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ task nativeLibraryJar(type: Jar, dependsOn: copyNativeLibrary) {
archiveClassifier = nativeName
from outputsFolder
}
build.dependsOn nativeLibraryJar

publishing {
repositories {
Expand Down

0 comments on commit 01e0f78

Please sign in to comment.