diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3010bad..4f5974d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -339,10 +339,55 @@ jobs: path: artifact/* - name: Generate RELEASE_NAME - if: env.RELEASE == 'true' run: | echo "RELEASE_NAME=${{ matrix.artifact_name }}-${{ env.ONNXRUNTIME_VERSION }}" >> "$GITHUB_ENV" + - name: Generate specifications + run: | + build_opts=(${{ matrix.build_opts }}) + + for arg in "${build_opts[@]}"; do + case "$arg" in + CMAKE_SYSTEM_NAME=Windows) os=Windows ;; + CMAKE_SYSTEM_NAME=Linux) os=Linux ;; + CMAKE_SYSTEM_NAME=Darwin) os=macOS ;; + --android) os=Android ;; + --ios) os=iOS ;; + + CMAKE_SYSTEM_PROCESSOR=x86_64 | CMAKE_OSX_ARCHITECTURES=x86_64 | x86_64) arch=x86_64 ;; + --x86) arch=x86 ;; + CMAKE_OSX_ARCHITECTURES=arm64 | --arm64 | arm64 | arm64-v8a) arch=AArch64 ;; + --arm) arch=ARMv7 ;; + + --use_cuda) use_cuda=1 ;; + --use_dml) use_dml=1 ;; + esac + done + + jq ' + { + "os": $os, + "arch": $arch, + # ONNX Runtimeが示す順番に従う + "devices": [ + ("CUDA" | select($use_cuda == "1")), + ("DirectML" | select($use_dml == "1")), + "CPU" + ] | join("/") + }' \ + -n \ + --arg os "$os" \ + --arg arch "$arch" \ + --arg use_cuda "$use_cuda" \ + --arg use_dml "$use_dml" \ + > "$RELEASE_NAME.json" + + - name: Upload specifications + uses: actions/upload-artifact@v4 + with: + name: specs-${{ matrix.artifact_name }} + path: ${{ env.RELEASE_NAME }}.json + - name: Rearchive artifact if: env.RELEASE == 'true' run: | @@ -360,10 +405,15 @@ jobs: build-xcframework: needs: build-onnxruntime runs-on: macos-12 + outputs: + release-name: ${{ steps.gen-envs.outputs.release-name }} steps: - name: Generate RELEASE_NAME and ONNXRUNTIME_BASENAME + id: gen-envs run: | - echo "RELEASE_NAME=onnxruntime-ios-xcframework-${{ env.ONNXRUNTIME_VERSION }}" >> "$GITHUB_ENV" + RELEASE_NAME=onnxruntime-ios-xcframework-${{ env.ONNXRUNTIME_VERSION }} + echo "release-name=$RELEASE_NAME" >> "$GITHUB_OUTPUT" + echo "RELEASE_NAME=$RELEASE_NAME" >> "$GITHUB_ENV" echo "ONNXRUNTIME_BASENAME=libonnxruntime.${{ env.ONNXRUNTIME_VERSION }}.dylib" >> "$GITHUB_ENV" - uses: actions/checkout@v3 @@ -441,3 +491,80 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ env.ONNXRUNTIME_VERSION }} # ==> github.event.release.tag_name file: ${{ env.RELEASE_NAME }}.zip + + build-spec-table: + needs: [build-onnxruntime, build-xcframework] + runs-on: ubuntu-22.04 + steps: + - name: Download specifications + uses: actions/download-artifact@v4 + with: + path: specs + pattern: specs-* + merge-multiple: true + + - name: Construct release notes + run: | + release_notes=$( + cat < + + + OS + アーキテクチャ + デバイス + 名前 + + + + EOF + ) + release_notes+=$'\n' + for specs_file in specs/*.json; do + specs=$(< "$specs_file") + release_name=$(basename "${specs_file%.json}") + release_notes+=$' \n' + release_notes+=" $(jq .os -r <<< "$specs")"$'\n' + release_notes+=" $(jq .arch -r <<< "$specs")"$'\n' + release_notes+=" $(jq .devices -r <<< "$specs")"$'\n' + release_notes+=" $release_name.tgz"$'\n' + release_notes+=$' \n' + done + release_notes+=$( + cat < + + + ## XCFramework + + + + + + + + + + + + + + + + + + +
OSアーキテクチャデバイス名前
iOSAArch64/x86_64CPU${{ needs.build-xcframework.outputs.release-name }}.zip
+ EOF + ) + tee release-notes.md >&2 <<< "$release_notes" + + - name: Update release notes + if: env.RELEASE == 'true' + uses: softprops/action-gh-release@v2 + with: + body_path: release-notes.md + prerelease: true + tag_name: ${{ env.ONNXRUNTIME_VERSION }}