Merge pull request #2 from wieslawsoltes/feat/avalonia-12-upgrade #12
Workflow file for this run
This file contains hidden or 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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| native-linux: | |
| uses: ./.github/workflows/native-build.yml | |
| with: | |
| runner: ubuntu-latest | |
| configuration: Release | |
| artifact-name: native-linux | |
| native-linux-arm64: | |
| uses: ./.github/workflows/native-build.yml | |
| with: | |
| runner: ubuntu-22.04-arm | |
| configuration: Release | |
| artifact-name: native-linux-arm64 | |
| native-macos: | |
| uses: ./.github/workflows/native-build.yml | |
| with: | |
| runner: macos-latest | |
| configuration: Release | |
| artifact-name: native-macos | |
| native-macos-x64: | |
| uses: ./.github/workflows/native-build.yml | |
| with: | |
| runner: macos-15-intel | |
| configuration: Release | |
| artifact-name: native-macos-x64 | |
| native-windows: | |
| uses: ./.github/workflows/native-build.yml | |
| with: | |
| runner: windows-latest | |
| configuration: Release | |
| artifact-name: native-windows | |
| native-windows-arm64: | |
| uses: ./.github/workflows/native-build.yml | |
| with: | |
| runner: windows-latest | |
| configuration: Release | |
| architecture: arm64 | |
| artifact-name: native-windows-arm64 | |
| ios-xcframework: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| brew update | |
| brew install cmake | |
| - name: Package iOS XCFramework | |
| run: | | |
| chmod +x build/scripts/package-ios-xcframework.sh | |
| ./build/scripts/package-ios-xcframework.sh | |
| shell: bash | |
| - name: Upload iOS artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ios-xcframework | |
| path: artifacts/ios/ | |
| android-aar: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake ninja-build zip | |
| - name: Setup Java | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - name: Setup Android SDK/NDK | |
| uses: android-actions/setup-android@v3 | |
| with: | |
| api-level: 34 | |
| build-tools: 34.0.0 | |
| ndk: 26.1.10909125 | |
| - name: Export Android environment variables | |
| run: | | |
| if [[ -n "${ANDROID_HOME}" ]]; then | |
| echo "ANDROID_SDK_ROOT=${ANDROID_HOME}" >> "${GITHUB_ENV}" | |
| fi | |
| if [[ -n "${ANDROID_NDK_HOME}" ]]; then | |
| echo "ANDROID_NDK_ROOT=${ANDROID_NDK_HOME}" >> "${GITHUB_ENV}" | |
| fi | |
| shell: bash | |
| - name: Package Android AAR | |
| run: | | |
| chmod +x build/scripts/package-android-aar.sh | |
| ./build/scripts/package-android-aar.sh | |
| shell: bash | |
| - name: Upload Android artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-aar | |
| path: artifacts/android/ | |
| android-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y unzip | |
| - name: Setup Java | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| with: | |
| api-level: 34 | |
| build-tools: 34.0.0 | |
| - name: Run bridge unit tests | |
| uses: gradle/gradle-build-action@v2 | |
| with: | |
| gradle-version: 8.4 | |
| build-root-directory: tests/android/bridge-tests | |
| arguments: test | |
| wasm-package: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Setup Emscripten | |
| uses: mymindstorm/setup-emsdk@v14 | |
| with: | |
| version: latest | |
| - name: Package WebAssembly artifacts | |
| run: | | |
| chmod +x build/scripts/package-wasm.sh | |
| ./build/scripts/package-wasm.sh | |
| shell: bash | |
| - name: Upload Web artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wasm-package | |
| path: artifacts/web/ | |
| managed: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - native-linux | |
| - native-linux-arm64 | |
| - native-macos | |
| - native-macos-x64 | |
| - native-windows | |
| - native-windows-arm64 | |
| - ios-xcframework | |
| - android-aar | |
| - android-tests | |
| - wasm-package | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-3-dev ninja-build clang-format unzip rsync | |
| - name: Restore .NET solution | |
| run: dotnet restore NativeMessageBox.sln | |
| - name: Build .NET solution | |
| run: dotnet build NativeMessageBox.sln --configuration Release --no-restore | |
| - name: Run tests | |
| run: dotnet test NativeMessageBox.sln --configuration Release --no-build | |
| - name: Build native host artifacts | |
| run: ./build/build.sh Release --skip-dotnet --skip-tests | |
| - name: Download native Linux artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-linux | |
| path: artifacts/native/linux | |
| - name: Download native Linux arm64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-linux-arm64 | |
| path: artifacts/native/linux-arm64 | |
| - name: Download native macOS artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-macos | |
| path: artifacts/native/macos | |
| - name: Download native macOS x64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-macos-x64 | |
| path: artifacts/native/macos-x64 | |
| - name: Download native Windows artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-windows | |
| path: artifacts/native/windows | |
| - name: Download native Windows arm64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-windows-arm64 | |
| path: artifacts/native/windows-arm64 | |
| - name: Prepare native runtime artifacts | |
| run: | | |
| set -euo pipefail | |
| shopt -s nullglob | |
| for platform in linux linux-arm64 macos macos-x64 windows windows-arm64; do | |
| root="artifacts/native/${platform}" | |
| extracted="${root}/extracted" | |
| rm -rf "${extracted}" | |
| mkdir -p "${root}" | |
| mkdir -p "${extracted}" | |
| extracted_any=false | |
| for archive in "${root}"/*.zip; do | |
| extracted_any=true | |
| unzip -q "${archive}" -d "${extracted}" | |
| done | |
| env_var="" | |
| case "${platform}" in | |
| linux) env_var="LINUX_NATIVE_SOURCE" ;; | |
| linux-arm64) env_var="LINUX_ARM64_NATIVE_SOURCE" ;; | |
| macos) env_var="MACOS_NATIVE_SOURCE" ;; | |
| macos-x64) env_var="MACOS_X64_NATIVE_SOURCE" ;; | |
| windows) env_var="WINDOWS_NATIVE_SOURCE" ;; | |
| windows-arm64) env_var="WINDOWS_ARM64_NATIVE_SOURCE" ;; | |
| esac | |
| if [[ -z "${env_var}" ]]; then | |
| continue | |
| fi | |
| if [[ "${extracted_any}" == "true" ]]; then | |
| echo "${env_var}=${extracted}" >> "${GITHUB_ENV}" | |
| else | |
| echo "${env_var}=${root}" >> "${GITHUB_ENV}" | |
| fi | |
| done | |
| - name: Sync native runtime layouts | |
| run: | | |
| ./build/scripts/sync-native-runtime.sh --source "${LINUX_NATIVE_SOURCE}" --rid "${LINUX_RID}" | |
| ./build/scripts/sync-native-runtime.sh --source "${LINUX_ARM64_NATIVE_SOURCE}" --rid "${LINUX_ARM64_RID}" | |
| ./build/scripts/sync-native-runtime.sh --source "${MACOS_NATIVE_SOURCE}" --rid "${MACOS_RID}" | |
| ./build/scripts/sync-native-runtime.sh --source "${MACOS_X64_NATIVE_SOURCE}" --rid "${MACOS_X64_RID}" | |
| ./build/scripts/sync-native-runtime.sh --source "${WINDOWS_NATIVE_SOURCE}" --rid "${WINDOWS_RID}" | |
| ./build/scripts/sync-native-runtime.sh --source "${WINDOWS_ARM64_NATIVE_SOURCE}" --rid "${WINDOWS_ARM64_RID}" | |
| env: | |
| LINUX_RID: ${{ needs.native-linux.outputs.rid }} | |
| LINUX_ARM64_RID: ${{ needs.native-linux-arm64.outputs.rid }} | |
| MACOS_RID: ${{ needs.native-macos.outputs.rid }} | |
| MACOS_X64_RID: ${{ needs.native-macos-x64.outputs.rid }} | |
| WINDOWS_RID: ${{ needs.native-windows.outputs.rid }} | |
| WINDOWS_ARM64_RID: ${{ needs.native-windows-arm64.outputs.rid }} | |
| - name: Download iOS artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ios-xcframework | |
| path: artifacts/ios | |
| - name: Download Android artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: android-aar | |
| path: artifacts/android | |
| - name: Download Web artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wasm-package | |
| path: artifacts/web | |
| - name: Sync mobile and browser runtimes | |
| run: | | |
| ./build/scripts/sync-mobile-runtimes.sh \ | |
| --android artifacts/android \ | |
| --ios artifacts/ios \ | |
| --web artifacts/web | |
| shell: bash | |
| - name: Pack NuGet artifacts | |
| run: | | |
| mkdir -p artifacts/nuget | |
| dotnet pack src/dotnet/NativeMessageBox/NativeMessageBox.csproj --configuration Release --no-build --output artifacts/nuget | |
| - name: Verify NuGet runtimes | |
| run: | | |
| package=$(ls artifacts/nuget/NativeMessageBox*.nupkg | head -n 1) | |
| ./build/scripts/verify-nuget-runtimes.sh --package "${package}" --rids "${REQUIRED_RIDS}" | |
| env: | |
| LINUX_RID: ${{ needs.native-linux.outputs.rid }} | |
| LINUX_ARM64_RID: ${{ needs.native-linux-arm64.outputs.rid }} | |
| MACOS_RID: ${{ needs.native-macos.outputs.rid }} | |
| MACOS_X64_RID: ${{ needs.native-macos-x64.outputs.rid }} | |
| WINDOWS_RID: ${{ needs.native-windows.outputs.rid }} | |
| WINDOWS_ARM64_RID: ${{ needs.native-windows-arm64.outputs.rid }} | |
| REQUIRED_RIDS: ${{ format('{0},{1},{2},{3},{4},{5},android-arm,android-arm64,android-x64,ios,ios-arm64,iossimulator,iossimulator-arm64,iossimulator-x64,browser-wasm', needs.native-linux.outputs.rid, needs.native-linux-arm64.outputs.rid, needs.native-macos.outputs.rid, needs.native-macos-x64.outputs.rid, needs.native-windows.outputs.rid, needs.native-windows-arm64.outputs.rid) }} | |
| - name: Archive native packaged artifacts | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| shopt -s nullglob | |
| mkdir -p artifacts/native-archives | |
| copied=false | |
| for archive in artifacts/native/*/*.zip; do | |
| cp "${archive}" artifacts/native-archives/ | |
| copied=true | |
| done | |
| if [[ "${copied}" != "true" ]]; then | |
| echo "No native archives found under artifacts/native" >&2 | |
| exit 1 | |
| fi | |
| - name: Archive mobile artifacts | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| cd artifacts | |
| mkdir -p mobile-archives | |
| if [ -d ios ]; then | |
| rm -f mobile-archives/native-ios.zip | |
| zip -q -r mobile-archives/native-ios.zip ios | |
| fi | |
| if [ -d android ]; then | |
| rm -f mobile-archives/native-android.zip | |
| zip -q -r mobile-archives/native-android.zip android | |
| fi | |
| if [ -d web ]; then | |
| rm -f mobile-archives/native-web.zip | |
| zip -q -r mobile-archives/native-web.zip web | |
| fi | |
| - name: Upload native release archives | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: native-artifacts | |
| path: artifacts/native-archives/native-*.zip | |
| if-no-files-found: error | |
| - name: Upload mobile release archives | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mobile-artifacts | |
| path: artifacts/mobile-archives/native-*.zip | |
| if-no-files-found: error | |
| - name: Publish NuGet artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-packages | |
| path: artifacts/nuget/*.nupkg | |
| publish-nuget: | |
| runs-on: ubuntu-latest | |
| needs: managed | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
| steps: | |
| - name: Download NuGet packages | |
| if: ${{ env.NUGET_API_KEY != '' }} | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: nuget-packages | |
| path: artifacts/nuget | |
| - name: Push to NuGet.org | |
| if: ${{ env.NUGET_API_KEY != '' }} | |
| run: dotnet nuget push artifacts/nuget/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| github-release: | |
| runs-on: ubuntu-latest | |
| needs: [managed, publish-nuget] | |
| if: ${{ always() && needs.managed.result == 'success' && (needs.publish-nuget.result == 'success' || needs.publish-nuget.result == 'skipped') }} | |
| steps: | |
| - name: Download NuGet packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: nuget-packages | |
| path: artifacts/nuget | |
| - name: Download native packaged artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-artifacts | |
| path: artifacts/native-archives | |
| - name: Download mobile archives | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: mobile-artifacts | |
| path: artifacts/mobile-archives | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| artifacts/nuget/*.nupkg | |
| artifacts/native-archives/native-*.zip | |
| artifacts/mobile-archives/native-*.zip |