Skip to content

Commit

Permalink
config: create an action to build ruke (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
kauefraga authored May 4, 2024
1 parent 3c597fa commit e610eb9
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build
on: [push]
env:
PROJECT_NAME: ruke
jobs:
build:
runs-on: ${{ matrix.runner }}

strategy:
matrix:
include:
- name: linux-amd64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- name: win-amd64
runner: windows-latest
target: x86_64-pc-windows-msvc
- name: macos-amd64
runner: macos-latest
target: x86_64-apple-darwin
- name: macos-arm64
runner: macos-latest
target: aarch64-apple-darwin

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: "${{ matrix.target }}"

- name: Setup Cache
uses: Swatinem/rust-cache@v2

- name: Build Binary
run: cargo build --verbose --locked --release --target ${{ matrix.target }}

- name: Release Binary
shell: bash
run: |
BIN_SUFFIX=""
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
BIN_SUFFIX=".exe"
fi
# The built binary output location
BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}"

# Define a better name for the final binary
BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}"
BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}${BIN_SUFFIX}"

# Move the built binary where you want it
mv "${BIN_OUTPUT}" "./bin/${BIN_RELEASE}"

0 comments on commit e610eb9

Please sign in to comment.