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

v0.5.2

v0.5.2 #14

Workflow file for this run

name: Build and Release
on:
release:
types: [created]
workflow_dispatch:
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
native-build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
extension: .exe
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
run: |
rustup update --no-self-update stable
rustup target add ${{ matrix.target }}
rustup default stable
- name: Setup Cache
uses: Swatinem/rust-cache@v2
env:
cache-name: cache-cargo-${{ matrix.target }}
with:
prefix-key: "downapk-v1"
shared-key: ${{ runner.os }}-cargo-
key: ${{ runner.os }}-cargo-${{ matrix.target }}-
cache-directories: |
C:\Users\runneradmin\.cargo
/Users/runner/.cargo
- name: Build for ${{ matrix.target }}
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/downapk${{ matrix.extension }}
asset_name: downapk-${{ matrix.target }}${{ matrix.extension }}
tag: ${{ github.ref }}
file_glob: false
cross-build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- target: aarch64-unknown-linux-gnu
- target: aarch64-linux-android
- target: armv7-unknown-linux-gnueabihf
- target: armv7-linux-androideabi
- target: x86_64-linux-android
- target: i686-unknown-linux-gnu
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
run: |
rustup update --no-self-update stable
rustup target add ${{ matrix.target }}
- name: Setup Cache
uses: Swatinem/rust-cache@v2
env:
cache-name: cache-cargo-${{ matrix.target }}
with:
prefix-key: "downapk-v1"
shared-key: ${{ runner.os }}-cargo-
key: ${{ runner.os }}-cargo-${{ matrix.target }}-
- name: Install dependencies
run: |
cargo install cross --git https://github.com/cross-rs/cross
- name: Build ${{ matrix.target }}
run: cross 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/downapk
asset_name: downapk-${{ matrix.target }}
tag: ${{ github.ref }}
file_glob: false
publish:
needs: [native-build, cross-build]
runs-on: ubuntu-latest
name: "Publish to Cargo"
environment:
name: Cargo
url: https://crates.io/crates/downapk
steps:
- uses: actions/checkout@master
# Use caching to speed up your build
- name: Setup Cache
uses: Swatinem/rust-cache@v2
env:
cache-name: cache-cargo
with:
prefix-key: "downapk-v1"
shared-key: ${{ runner.os }}-cargo-
key: ${{ runner.os }}-cargo-
- name: Setup cargo
run: |
rustup update --no-self-update stable
- name: Cargo publish
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}