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 #44

Workflow file for this run

name: Build and Upload Rust Binaries
on:
release:
types: [created]
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
permissions:
contents: write
strategy:
matrix:
include:
- os: ubuntu-latest
container: rust:latest
target: x86_64-unknown-linux-gnu
filename: downapk-x86_64-linux
- os: macos-latest
container: null
target: x86_64-apple-darwin
filename: downapk-x86_64-darwin
- os: windows-latest
container: null
target: x86_64-pc-windows-msvc
filename: downapk-x86_64-windows.exe
- os: ubuntu-latest
container: rustlang/rust:nightly-alpine
target: aarch64-unknown-linux-gnu
filename: downapk-aarch64-linux
- os: macos-latest
container: null
target: aarch64-apple-darwin
filename: downapk-aarch64-darwin
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
if: matrix.os != 'ubuntu-latest'
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
target: ${{ matrix.target }}
- name: Install OpenSSL on Alpine container
if: matrix.container == 'rustlang/rust:nightly-alpine'
run: |
apk add --no-cache openssl openssl-dev
- name: Install rust toolchain
run: |
rustup target add ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Upload unix-like binaries to release
uses: svenstaro/upload-release-action@v2
if: contains(matrix.target, 'windows') == false
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/downapk
asset_name: ${{ matrix.filename }}
tag: ${{ github.ref }}
file_glob: false
- name: Upload windows binaries to release
uses: svenstaro/upload-release-action@v2
if: contains(matrix.target, 'windows') == true
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/downapk.exe
asset_name: ${{ matrix.filename }}
tag: ${{ github.ref }}
file_glob: false