mirror of
https://github.com/balt-dev/appleone.git
synced 2024-06-01 01:41:36 +00:00
79 lines
2.2 KiB
YAML
79 lines
2.2 KiB
YAML
name: Build
|
|
on: [push]
|
|
|
|
env:
|
|
# The project name specified in your Cargo.toml
|
|
PROJECT_NAME: apple-one
|
|
jobs:
|
|
build:
|
|
# Set the job to run on the platform specified by the matrix below
|
|
runs-on: ${{ matrix.runner }}
|
|
permissions:
|
|
contents: write
|
|
# Define the build matrix for cross-compilation
|
|
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
|
|
|
|
# The steps to run for each matrix item
|
|
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 --release --target ${{ matrix.target }}
|
|
|
|
- name: Release Binary
|
|
shell: bash
|
|
run: |
|
|
mkdir build
|
|
|
|
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.sha }}-${{ matrix.name }}${BIN_SUFFIX}"
|
|
|
|
# Move the built binary where you want it
|
|
mv "${BIN_OUTPUT}" "build/${BIN_RELEASE}"
|
|
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: "Commit-${{ github.sha }}"
|
|
files: |
|
|
build/*
|
|
LICENSE
|
|
|
|
- name: Remove temporary directory
|
|
run: |
|
|
rm -r build
|