Fixed ESP32 Build #6
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: | |
| branches: | |
| - main | |
| - development | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| name: linux-x64 | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| name: linux-arm64 | |
| use_cross: true | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| name: macos-x64 | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| name: macos-arm64 | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| name: windows-x64 | |
| - os: ubuntu-latest | |
| target: armv7-unknown-linux-gnueabihf | |
| name: pi-armv7 | |
| use_cross: true | |
| - os: ubuntu-latest | |
| target: aarch64-linux-android | |
| name: android-arm64 | |
| use_cross: true | |
| - os: ubuntu-latest | |
| target: armv7-linux-androideabi | |
| name: android-armv7 | |
| use_cross: true | |
| - os: ubuntu-latest | |
| target: thumbv7em-none-eabihf | |
| name: embedded-arm | |
| use_cross: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Read version from VERSION file | |
| id: version | |
| run: | | |
| if [ -f VERSION ]; then | |
| VERSION=$(cat VERSION | tr -d '\n\r') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=0.1.0" >> $GITHUB_OUTPUT | |
| fi | |
| shell: bash | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install system dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt update | |
| sudo apt install -y \ | |
| build-essential \ | |
| pkg-config \ | |
| libdbus-1-dev \ | |
| libdbus-glib-1-dev \ | |
| libudev-dev \ | |
| libbluetooth-dev \ | |
| protobuf-compiler | |
| - name: Install protoc (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: brew install protobuf | |
| - name: Install protoc (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: choco install protoc | |
| - name: Install cross | |
| if: matrix.use_cross == true | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Build with cross | |
| if: matrix.use_cross == true | |
| run: cross build --release --target ${{ matrix.target }} || echo "Build failed for ${{ matrix.target }}" | |
| continue-on-error: true | |
| - name: Build with cargo | |
| if: matrix.use_cross != true | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Package (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| mkdir -p dist | |
| cp target/${{ matrix.target }}/release/metamesh-daemon dist/ 2>/dev/null || echo "daemon not found for ${{ matrix.target }}" | |
| cp target/${{ matrix.target }}/release/metamesh-client dist/ 2>/dev/null || echo "client not found for ${{ matrix.target }}" | |
| if [ -f dist/metamesh-daemon ] || [ -f dist/metamesh-client ]; then | |
| tar -czf metamesh-${{ matrix.name }}-v${{ steps.version.outputs.version }}.tar.gz -C dist . | |
| else | |
| echo "No binaries found for ${{ matrix.target }}, creating empty archive" | |
| touch dist/README.txt | |
| echo "Build failed for ${{ matrix.target }}" > dist/README.txt | |
| tar -czf metamesh-${{ matrix.name }}-v${{ steps.version.outputs.version }}.tar.gz -C dist . | |
| fi | |
| - name: Package (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| mkdir dist | |
| copy target\${{ matrix.target }}\release\metamesh-daemon.exe dist\ 2>nul || echo "daemon not found" | |
| copy target\${{ matrix.target }}\release\metamesh-client.exe dist\ 2>nul || echo "client not found" | |
| Compress-Archive -Path dist\* -DestinationPath metamesh-${{ matrix.name }}-v${{ steps.version.outputs.version }}.zip | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: metamesh-${{ matrix.name }}-v${{ steps.version.outputs.version }} | |
| path: metamesh-${{ matrix.name }}-v${{ steps.version.outputs.version }}.* | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Read version from VERSION file | |
| id: version | |
| run: | | |
| if [ -f VERSION ]; then | |
| VERSION=$(cat VERSION | tr -d '\n\r') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=0.1.0" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Delete existing release (if exists) | |
| run: | | |
| gh release delete v${{ steps.version.outputs.version }} --yes || echo "Release doesn't exist" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| name: MetaMesh v${{ steps.version.outputs.version }} | |
| files: | | |
| metamesh-linux-x64-v${{ steps.version.outputs.version }}/metamesh-linux-x64-v${{ steps.version.outputs.version }}.tar.gz | |
| metamesh-linux-arm64-v${{ steps.version.outputs.version }}/metamesh-linux-arm64-v${{ steps.version.outputs.version }}.tar.gz | |
| metamesh-macos-x64-v${{ steps.version.outputs.version }}/metamesh-macos-x64-v${{ steps.version.outputs.version }}.tar.gz | |
| metamesh-macos-arm64-v${{ steps.version.outputs.version }}/metamesh-macos-arm64-v${{ steps.version.outputs.version }}.tar.gz | |
| metamesh-windows-x64-v${{ steps.version.outputs.version }}/metamesh-windows-x64-v${{ steps.version.outputs.version }}.zip | |
| metamesh-pi-armv7-v${{ steps.version.outputs.version }}/metamesh-pi-armv7-v${{ steps.version.outputs.version }}.tar.gz | |
| metamesh-android-arm64-v${{ steps.version.outputs.version }}/metamesh-android-arm64-v${{ steps.version.outputs.version }}.tar.gz | |
| metamesh-android-armv7-v${{ steps.version.outputs.version }}/metamesh-android-armv7-v${{ steps.version.outputs.version }}.tar.gz | |
| metamesh-embedded-arm-v${{ steps.version.outputs.version }}/metamesh-embedded-arm-v${{ steps.version.outputs.version }}.tar.gz | |
| generate_release_notes: true | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |