Skip to content

Commit

Permalink
Add build script
Browse files Browse the repository at this point in the history
  • Loading branch information
lhvy committed Nov 1, 2023
1 parent 96d67d8 commit f05caed
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CD
on: workflow_dispatch

env:
RELEASE_BIN: sneaky

jobs:
build_release:
name: Build release
strategy:
matrix:
include:
- os: ubuntu-latest
targets: [x86_64-unknown-linux-gnu]
- os: macos-latest
targets: [x86_64-apple-darwin, aarch64-apple-darwin]
- os: windows-latest
targets: [x86_64-pc-windows-msvc]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ join(matrix.targets, ',') }}

- name: Build
shell: bash
run: |
for target in ${{ join(matrix.targets, ' ') }}; do
cargo build --release --target $target
done
- name: Upload Linux archive
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_BIN }}-linux-x86_64
path: ./target/x86_64-unknown-linux-gnu/release/${{ env.RELEASE_BIN }}
if: matrix.os == 'ubuntu-latest'

- name: Upload Windows archive
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_BIN }}-windows-x86_64.exe
path: /target/x86_64-pc-windows-msvc/release/${{ env.RELEASE_BIN }}.exe
if: matrix.os == 'windows-latest'

- name: Create macOS archive
run: |
lipo -create -output ./${{ env.RELEASE_BIN }}-mac-universal ./target/x86_64-apple-darwin/release/${{ env.RELEASE_BIN }} ./target/aarch64-apple-darwin/release/${{ env.RELEASE_BIN }}
if: matrix.os == 'macos-latest'

- name: Upload macOS archive
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_BIN }}-mac-universal
path: ./${{ env.RELEASE_BIN }}-mac-universal
if: matrix.os == 'macos-latest'

0 comments on commit f05caed

Please sign in to comment.