change package name #32
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: Build | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
env: | |
FRAMEWORK: net8.0 | |
CONFIGURATION: Release | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
jobs: | |
build-android: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Build ZXing-C++ | |
run: | | |
for abi in armeabi-v7a arm64-v8a x86 x86_64 ; do | |
cmake -S zxing-cpp -B "zxing-cpp.android-$abi" \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DBUILD_SHARED_LIBS=ON \ | |
-DZXING_READERS=ON \ | |
-DZXING_WRITERS=OFF \ | |
-DCMAKE_CXX_STANDARD=20 \ | |
-DZXING_C_API=ON \ | |
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \ | |
-DANDROID_ABI=$abi | |
cmake --build "zxing-cpp.android-$abi" --config Release | |
mkdir "android-$abi" | |
cp "zxing-cpp.android-$abi/core/libZXing.so" "android-$abi/libZXing.so" | |
$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip "android-$abi/libZXing.so" | |
done | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zxingcpp-android | |
path: | | |
android-armeabi-v7a/libZXing.so | |
android-arm64-v8a/libZXing.so | |
android-x86/libZXing.so | |
android-x86_64/libZXing.so | |
build-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Build ZXing-C++ | |
run: | | |
cmake -S zxing-cpp -B zxing-cpp.build \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DBUILD_SHARED_LIBS=ON \ | |
-DZXING_READERS=ON \ | |
-DZXING_WRITERS=OFF \ | |
-DCMAKE_CXX_STANDARD=20 \ | |
-DZXING_C_API=ON | |
cmake --build zxing-cpp.build --config Release | |
cp zxing-cpp.build/core/libZXing.so libZXing.so | |
strip --strip-debug libZXing.so | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zxingcpp-linux | |
path: libZXing.so | |
build-mac: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Build ZXing-C++ | |
run: | | |
cmake -S zxing-cpp -B zxing-cpp.build \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DBUILD_SHARED_LIBS=ON \ | |
-DZXING_READERS=ON \ | |
-DZXING_WRITERS=OFF \ | |
-DCMAKE_CXX_STANDARD=20 \ | |
-DZXING_C_API=ON | |
cmake --build zxing-cpp.build --config Release | |
cp zxing-cpp.build/core/libZXing.dylib libZXing.dylib | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zxingcpp-mac | |
path: libZXing.dylib | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Build ZXing-C++ | |
run: | | |
cmake -S zxing-cpp -B zxing-cpp.build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DZXING_READERS=ON -DZXING_WRITERS=OFF -DCMAKE_CXX_STANDARD=20 -DZXING_C_API=ON | |
cmake --build zxing-cpp.build --config Release | |
cp zxing-cpp.build/core/Release/ZXing.dll ZXing.dll | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zxingcpp-windows | |
path: ZXing.dll | |
package: | |
runs-on: ubuntu-latest | |
needs: | |
- build-android | |
- build-linux | |
- build-mac | |
- build-windows | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Build | |
run: | | |
mkdir -p "Stratum.ZXing/runtimes/linux-x64" | |
cp "artifacts/zxingcpp-linux/libZXing.so" "Stratum.ZXing/runtimes/linux-x64/libZXing.so" | |
cp "artifacts/zxingcpp-linux/libZXing.so" "Stratum.ZXing/libZXing.so" | |
mkdir -p "Stratum.ZXing/runtimes/osx" | |
cp "artifacts/zxingcpp-mac/libZXing.dylib" "Stratum.ZXing/runtimes/osx/libZXing.dylib" | |
mkdir -p "Stratum.ZXing/runtimes/win-x64" | |
cp "artifacts/zxingcpp-windows/ZXing.dll" "Stratum.ZXing/runtimes/win-x64/ZXing.dll" | |
mkdir -p "Stratum.ZXing/runtimes/android-armeabi-v7a" | |
cp "artifacts/zxingcpp-android/android-armeabi-v7a/libZXing.so" "Stratum.ZXing/runtimes/android-armeabi-v7a/libZXing.so" | |
mkdir -p "Stratum.ZXing/runtimes/android-arm64-v8a" | |
cp "artifacts/zxingcpp-android/android-arm64-v8a/libZXing.so" "Stratum.ZXing/runtimes/android-arm64-v8a/libZXing.so" | |
mkdir -p "Stratum.ZXing/runtimes/android-x86_64" | |
cp "artifacts/zxingcpp-android/android-x86_64/libZXing.so" "Stratum.ZXing/runtimes/android-x86_64/libZXing.so" | |
mkdir -p "Stratum.ZXing/runtimes/android-x86" | |
cp "artifacts/zxingcpp-android/android-x86/libZXing.so" "Stratum.ZXing/runtimes/android-x86/libZXing.so" | |
dotnet build --configuration $CONFIGURATION Stratum.ZXing.sln | |
- name: Test | |
run: | | |
dotnet test --configuration $CONFIGURATION Stratum.ZXing.Test/Stratum.ZXing.Test.csproj | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: stratum-zxing | |
path: Stratum.ZXing/bin/**/Stratum.ZXing*.nupkg | |
- name: Publish package | |
run: | | |
pkg=$(find Stratum.ZXing/bin/$CONFIGURATION/ -name '*.nupkg') | |
dotnet nuget push $pkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json |