Update GitHub Actions workflow for macOS builds and remove deprecated… #2
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: Build and Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.package_name }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - package_name: machinetool-windows-amd64 | |
| runner: windows-2025 | |
| plugin_suffix: amd64 | |
| cmake_generator: Visual Studio 17 2022 | |
| cmake_generator_platform: x64 | |
| - package_name: machinetool-linux-x86_64 | |
| runner: ubuntu-24.04 | |
| plugin_suffix: x86_64 | |
| cmake_generator: Ninja | |
| - package_name: machinetool-linux-arm64 | |
| runner: ubuntu-24.04-arm | |
| plugin_suffix: arm64 | |
| cmake_generator: Ninja | |
| - package_name: machinetool-macos-x86_64 | |
| runner: macos-15-intel | |
| plugin_suffix: x86_64 | |
| cmake_generator: Ninja | |
| - package_name: machinetool-macos-arm64 | |
| runner: macos-15 | |
| plugin_suffix: arm64 | |
| cmake_generator: Ninja | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| PACKAGE_NAME: ${{ matrix.package_name }} | |
| PLUGIN_SUFFIX: ${{ matrix.plugin_suffix }} | |
| CMAKE_GENERATOR: ${{ matrix.cmake_generator }} | |
| CMAKE_GENERATOR_PLATFORM: ${{ matrix.cmake_generator_platform }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Configure | |
| run: | | |
| cmake_args=( | |
| -S . | |
| -B build | |
| -DCMAKE_INSTALL_PREFIX="$PWD/dist/${PACKAGE_NAME}" | |
| -DPLUGIN_SUFFIX="${PLUGIN_SUFFIX}" | |
| ) | |
| if [ -n "${CMAKE_GENERATOR:-}" ]; then | |
| cmake_args+=(-G "${CMAKE_GENERATOR}") | |
| fi | |
| if [ -n "${CMAKE_GENERATOR_PLATFORM:-}" ]; then | |
| cmake_args+=(-A "${CMAKE_GENERATOR_PLATFORM}") | |
| else | |
| cmake_args+=(-DCMAKE_BUILD_TYPE=Release) | |
| fi | |
| cmake "${cmake_args[@]}" | |
| - name: Build | |
| run: cmake --build build --config Release --parallel | |
| - name: Install | |
| run: cmake --install build --config Release --prefix "dist/${PACKAGE_NAME}" | |
| - name: Add runtime assets | |
| run: | | |
| cmake -E copy_directory models "dist/${PACKAGE_NAME}/models" | |
| cmake -E copy_if_different README.md "dist/${PACKAGE_NAME}/README.md" | |
| - name: Archive package | |
| run: cmake -E chdir dist cmake -E tar cf "${PACKAGE_NAME}.zip" --format=zip -- "${PACKAGE_NAME}" | |
| - name: Upload package | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| path: dist/${{ matrix.package_name }}.zip | |
| if-no-files-found: error | |
| archive: false | |
| release: | |
| name: Publish GitHub release | |
| needs: build | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| actions: read | |
| contents: write | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Download packages | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: release-assets | |
| pattern: machinetool-* | |
| merge-multiple: true | |
| skip-decompress: true | |
| - name: Create release | |
| env: | |
| GH_REPO: ${{ github.repository }} | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| short_sha="${GITHUB_SHA::7}" | |
| tag_name="build-${GITHUB_RUN_NUMBER}.${GITHUB_RUN_ATTEMPT}-${short_sha}" | |
| gh release create "${tag_name}" release-assets/*.zip \ | |
| --target "${GITHUB_SHA}" \ | |
| --title "machinetool ${short_sha}" \ | |
| --notes "Automated build from main at ${GITHUB_SHA}." \ | |
| --latest=false |