From d2645273ab54ca107b93a111f41952ab7cc119c5 Mon Sep 17 00:00:00 2001 From: Frank Bell Date: Sat, 13 Apr 2024 22:15:38 +0100 Subject: [PATCH] build(release): add macos support --- .github/workflows/release.yml | 53 ++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 36c551c4..0570cf7d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,9 +8,12 @@ on: ref: description: ref to build binary from required: false + push: + branches: + - 'frank/build-macos' jobs: - build-node: + build-node-for-linux: runs-on: ubuntu-22.04 permissions: contents: write @@ -24,6 +27,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: + fetch-depth: 0 ref: ${{ github.event.inputs.ref }} - name: Install packages @@ -46,6 +50,53 @@ jobs: name: binaries path: build + - name: Add binary to release + if: github.event_name == 'release' + uses: softprops/action-gh-release@v1 + with: + files: | + build/${{ env.name }} + build/${{ env.name }}.sha256 + + build-node-for-macos: + runs-on: macos-14 + permissions: + contents: write + strategy: + matrix: + target: [ "aarch64-apple-darwin", "x86_64-apple-darwin" ] + env: + name: "pop-node-${{ matrix.target }}" + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.inputs.ref }} + + - name: Install packages + run: | + brew install protobuf + protoc --version + + - name: Add target + run: rustup target add ${{ matrix.target }} + + - name: Build node + run: cargo build --profile=production -p pop-node --target ${{ matrix.target }} + + - name: Save binary + run: | + mkdir -p build + cp target/${{ matrix.target }}/production/pop-node build/${{ env.name }} + sha256sum build/${{ env.name }} > build/${{ env.name }}.sha256 + + - name: Upload binary + uses: actions/upload-artifact@v3 + with: + name: binaries + path: build + - name: Add binary to release if: github.event_name == 'release' uses: softprops/action-gh-release@v1