Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Build and Release

Build and Release #8

Workflow file for this run

name: Build and Upload Rust Binaries
on:
release:
types: [created]
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
# - os: ubuntu-latest
# target: aarch64-unknown-linux-gnu
- os: macos-latest
target: aarch64-apple-darwin
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Prepare binary filename
id: filename
run: |
if [ ${{ matrix.target }} = "x86_64-pc-windows-msvc" ]; then
echo "filename=downapk.exe" >> $GITHUB_OUTPUT
else
echo "filename=downapk" >> $GITHUB_OUTPUT
fi
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/${{ steps.filename.outputs.filename }}
asset_name: ${{ matrix.target }}-${{ steps.filename.outputs.filename }}
tag: ${{ github.ref }}
file_glob: true