v0.2.5 #3
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-binaries | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| artifact_name: resonix-node-${{ github.ref_name }}-linux-x86_64.tar.gz | |
| archive_ext: tar.gz | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| artifact_name: resonix-node-${{ github.ref_name }}-linux-aarch64.tar.gz | |
| archive_ext: tar.gz | |
| - os: ubuntu-latest | |
| target: armv7-unknown-linux-gnueabihf | |
| artifact_name: resonix-node-${{ github.ref_name }}-linux-armv7.tar.gz | |
| archive_ext: tar.gz | |
| # Windows | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| artifact_name: resonix-node-${{ github.ref_name }}-windows-x86_64.zip | |
| archive_ext: zip | |
| - os: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| artifact_name: resonix-node-${{ github.ref_name }}-windows-aarch64.zip | |
| archive_ext: zip | |
| # macOS (arm64 + Intel) | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact_name: resonix-node-${{ github.ref_name }}-macos-aarch64.tar.gz | |
| archive_ext: tar.gz | |
| - os: macos-13 | |
| target: x86_64-apple-darwin | |
| artifact_name: resonix-node-${{ github.ref_name }}-macos-x86_64.tar.gz | |
| archive_ext: tar.gz | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install Linux aarch64 cross toolchain | |
| if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| shell: bash | |
| - name: Install Linux armv7 cross toolchain | |
| if: ${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-arm-linux-gnueabihf | |
| shell: bash | |
| - name: Build | |
| run: | | |
| echo "Building target ${{ matrix.target }}" | |
| if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then | |
| export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc | |
| export AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar | |
| export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc | |
| fi | |
| if [[ "${{ matrix.target }}" == "armv7-unknown-linux-gnueabihf" ]]; then | |
| export CC_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc | |
| export AR_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-ar | |
| export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc | |
| fi | |
| cargo build --release --target ${{ matrix.target }} | |
| shell: bash | |
| - name: Package (Unix) | |
| if: ${{ matrix.archive_ext == 'tar.gz' }} | |
| run: | | |
| set -euxo pipefail | |
| BIN_NAME=resonix-node | |
| TARGET_DIR=target/${{ matrix.target }}/release | |
| mkdir -p dist | |
| cp "$TARGET_DIR/$BIN_NAME" dist/ | |
| tar -C dist -czf "${{ matrix.artifact_name }}" "$BIN_NAME" | |
| if command -v sha256sum >/dev/null 2>&1; then | |
| sha256sum "${{ matrix.artifact_name }}" > "${{ matrix.artifact_name }}.sha256" | |
| else | |
| shasum -a 256 "${{ matrix.artifact_name }}" | awk '{print $1 " " $2}' > "${{ matrix.artifact_name }}.sha256" | |
| fi | |
| shell: bash | |
| - name: Package (Windows) | |
| if: ${{ matrix.archive_ext == 'zip' }} | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| $binName = 'resonix-node.exe' | |
| $targetDir = "target/${{ matrix.target }}/release" | |
| New-Item -ItemType Directory -Force -Path dist | Out-Null | |
| Copy-Item -Path "$targetDir/$binName" -Destination dist/ | |
| $artifact = "${{ matrix.artifact_name }}" | |
| Compress-Archive -Path "dist/$binName" -DestinationPath $artifact -Force | |
| # Compute SHA256 | |
| $hash = Get-FileHash -Algorithm SHA256 $artifact | |
| Set-Content -NoNewline -Path "$artifact.sha256" -Value ("$($hash.Hash) $artifact") | |
| shell: pwsh | |
| - name: Upload to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| ${{ matrix.artifact_name }} | |
| ${{ matrix.artifact_name }}.sha256 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |