Skip to content

Rust build-and-release #82

Rust build-and-release

Rust build-and-release #82

name: Rust build-and-release
on:
workflow_dispatch: # Manually triggered
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- name: Install Rust target
run: rustup target add ${{ matrix.target }}
- name: Install cross (for cross-compilation)
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build
run: cross build --release --target=${{ matrix.target }}
- name: Get Version from Cargo.toml
id: cargo_version
run: |
THE_VERSION_STRING=$(cargo pkgid | cut -d@ -f2 | cut -d: -f2)
echo "t_cargo_version=$THE_VERSION_STRING" >> $GITHUB_ENV
- name: Zip Binary
uses: vimtor/action-zip@v1
with:
files: target/${{ matrix.target }}/release/limonium
dest: target/${{ matrix.target }}/release/limonium-${{ matrix.target }}.zip
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: limonium-${{ matrix.target }}
path: target/${{ matrix.target }}/release/limonium-${{ matrix.target }}.zip
release:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Deploy Release With Artifacts
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.t_cargo_version }}"
prerelease: false
files: artifacts/**