feat: pkg
tool
#114
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: Build | |
on: | |
push: | |
branches: [ "main" ] | |
tags: ["v*.*.*"] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
name: Build - ${{ matrix.platform.arch }} | |
strategy: | |
matrix: | |
platform: | |
- arch: x86_64 | |
target: x86_64-unknown-linux-musl | |
runs-on: ubuntu-latest | |
- arch: aarch64 | |
target: aarch64-unknown-linux-musl | |
runs-on: ubuntu-latest | |
runs-on: ${{ matrix.platform.runs-on }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build pkg tool | |
uses: houseabsolute/actions-rust-cross@v0 | |
with: | |
target: ${{ matrix.platform.target }} | |
args: "--locked --release --bin pkg" | |
strip: true | |
- name: Build base image | |
env: | |
ARCH: ${{ matrix.platform.arch }} | |
TARGET: ${{ matrix.platform.target }} | |
run: | | |
if [ "$ARCH" != "$(uname -m)" ]; then | |
sudo apt-get update | |
sudo apt-get install qemu-user-static | |
fi | |
cargo run --bin build-img -- -a $ARCH -b target/$TARGET/release/pkg | |
cargo clean | |
- name: Upload artifacts - base image | |
uses: actions/upload-artifact@v4 | |
with: | |
name: base-${{ matrix.platform.target }} | |
path: | | |
base.tar.xz | |
base.sha256 | |
- name: Build dive | |
uses: houseabsolute/actions-rust-cross@v0 | |
with: | |
target: ${{ matrix.platform.target }} | |
args: "--locked --release --features embedded_image" | |
strip: true | |
- name: Rename binary | |
env: | |
TARGET: ${{ matrix.platform.target }} | |
run: | | |
mv "target/$TARGET/release/dive" "dive-$TARGET" | |
- name: Upload artifacts - binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binary-${{ matrix.platform.target }} | |
path: dive-* | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
draft: true | |
files: dive-* |