Cargo.toml: add features #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install cross | |
run: cargo install cross | |
- name: Build for Linux (Debian) | |
run: cross build --release --target x86_64-unknown-linux-gnu --features "opt-level=s,panic=abort,codegen-units=1,link-arg=-s,link-arg=-O3,link-arg=-flto" | |
- name: Build for Linux (RPM-based) | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y rpm | |
cross build --release --target x86_64-unknown-linux-gnu --features "opt-level=s,panic=abort,codegen-units=1,link-arg=-s,link-arg=-O3,link-arg=-flto" | |
rpmbuild -bb rhred.spec | |
- name: Build for macOS | |
run: cross build --release --target x86_64-apple-darwin --features "opt-level=s,panic=abort,codegen-units=1,link-arg=-s,link-arg=-O3,link-arg=-flto" | |
- name: Build for Windows | |
run: cross build --release --target x86_64-pc-windows-msvc --features "opt-level=s,panic=abort,codegen-units=1,link-arg=-s,link-arg=-O3,link-arg=-flto" | |
- name: Set up Git | |
run: | | |
git config --global user.name "Shubh" | |
git config --global user.email "shubhisroking@proton.me" | |
- name: Create release | |
id: create_release | |
uses: ncipollo/release-action@v1.13.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
body: | | |
$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:'- %s%n') | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: rhred-linux-deb | |
path: target/x86_64-unknown-linux-gnu/release/rhred | |
if: ${{ success() }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: rhred-linux-rpm | |
path: rhred/target/rpmbuild/RPMS/x86_64/rhred-1.0.0-1.x86_64.rpm | |
if: ${{ success() }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: rhred-macos | |
path: target/x86_64-apple-darwin/release/rhred | |
if: ${{ success() }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: rhred-windows | |
path: target/x86_64-pc-windows-msvc/release/rhred.exe | |
if: ${{ success() }} |