From 2773881846857245642e1030a3a8cdba2d47cbb3 Mon Sep 17 00:00:00 2001 From: Raul Victor Trombin Date: Thu, 5 Sep 2024 14:21:42 -0300 Subject: [PATCH] github: action: Add build and deploy --- .github/workflows/action.yml | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 1d62d23..6288ad6 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -36,3 +36,59 @@ jobs: - name: Build run: cargo build --verbose + + build: + needs: quick-tests + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: macos-14 + TARGET: aarch64-apple-darwin + + - os: macos-14 + TARGET: x86_64-apple-darwin + + - os: ubuntu-22.04 + TARGET: aarch64-unknown-linux-musl + + - os: ubuntu-22.04 + TARGET: armv7-unknown-linux-musleabihf + + - os: ubuntu-22.04 + TARGET: x86_64-unknown-linux-gnu + + - os: windows-2022 + TARGET: x86_64-pc-windows-msvc + EXTENSION: .exe + + steps: + - name: Building ${{ matrix.TARGET }} + run: echo "${{ matrix.TARGET }}" + + - uses: actions/checkout@master + - name: Build + uses: houseabsolute/actions-rust-cross@v0.0.14 + with: + target: ${{ matrix.TARGET }} + args: "--release" + + - name: Rename + run: cp target/${{ matrix.TARGET }}/release/${{ github.event.repository.name }}${{ matrix.EXTENSION }} ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }} + + - uses: actions/upload-artifact@master + with: + name: ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }} + path: ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }} + + - uses: svenstaro/upload-release-action@v2 + name: Upload binaries to release + if: ${{ github.event_name == 'push' }} + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }} + asset_name: ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }} + tag: ${{ github.ref }} + prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }} + overwrite: true