added github workflow for building binaries with releases

This commit is contained in:
sreedev
2023-01-23 02:18:23 -05:00
parent 38f6c48452
commit 8acc3f8c8f
2 changed files with 44 additions and 20 deletions

44
.github/workflows/build_and_release.yml vendored Normal file
View File

@@ -0,0 +1,44 @@
name: Build and release
on:
push:
branches:
- main
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Build for Windows
run: |
cargo build --release --target x86_64-pc-windows-gnu
- name: Build for Linux
run: |
cargo build --release --target x86_64-unknown-linux-gnu
- name: Build for MacOS
run: |
cargo build --release --target x86_64-apple-darwin
- name: Create release
uses: actions/create-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

View File

@@ -1,20 +0,0 @@
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose