Skip to content

[ARK Drop] Enhancements and TUI (#106) (#108) #78

[ARK Drop] Enhancements and TUI (#106) (#108)

[ARK Drop] Enhancements and TUI (#106) (#108) #78

name: ARK Drop Release
on:
push:
paths:
- "drop-core/entities/**"
- "drop-core/exchanges/**"
- "drop-core/cli/**"
- "drop-core/tui/**"
- "drop-core/main/**"
- ".github/workflows/arkdrop-release.yml"
workflow_dispatch:
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux targets
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
archive: tar.gz
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
archive: tar.gz
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
archive: tar.gz
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
archive: tar.gz
- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
archive: tar.gz
- os: ubuntu-latest
target: armv7-unknown-linux-musleabihf
archive: tar.gz
# Windows targets
- os: windows-latest
target: x86_64-pc-windows-msvc
archive: zip
- os: windows-latest
target: i686-pc-windows-msvc
archive: zip
- os: windows-latest
target: aarch64-pc-windows-msvc
archive: zip
# macOS targets
- os: macos-13
target: x86_64-apple-darwin
archive: tar.gz
- os: macos-14
target: aarch64-apple-darwin
archive: tar.gz
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.75.0
targets: ${{ matrix.target }}
- name: Install additional targets
run: |
rustup target add ${{ matrix.target }}
- name: Set up Cargo cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install cross-compilation tools (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
case "${{ matrix.target }}" in
aarch64-unknown-linux-gnu)
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
;;
aarch64-unknown-linux-musl)
sudo apt-get install -y gcc-aarch64-linux-gnu musl-tools
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
;;
armv7-unknown-linux-gnueabihf)
sudo apt-get install -y gcc-arm-linux-gnueabihf
echo "CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV
;;
armv7-unknown-linux-musleabihf)
sudo apt-get install -y gcc-arm-linux-gnueabihf musl-tools
echo "CARGO_TARGET_ARMV7_UNKNOWN_LINUX_MUSLEABIHF_LINKER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV
;;
x86_64-unknown-linux-musl)
sudo apt-get install -y musl-tools
;;
esac
- name: Build binary
run: |
cargo build -p arkdrop --release --target ${{ matrix.target }}
- name: Create archive name
id: archive
shell: bash
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="arkdrop-v${{ github.run_id }}"
VERSION="${VERSION#arkdrop-v}"
fi
ARCHIVE_NAME="arkdrop-${VERSION}-${{ matrix.target }}"
echo "name=${ARCHIVE_NAME}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Create archive (Unix)
if: matrix.archive == 'tar.gz'
run: |
cd target/${{ matrix.target }}/release
if [ "${{ matrix.target }}" == *"windows"* ]; then
BINARY_NAME="arkdrop.exe"
else
BINARY_NAME="arkdrop"
fi
tar -czf ${{ steps.archive.outputs.name }}.tar.gz ${BINARY_NAME}
mv ${{ steps.archive.outputs.name }}.tar.gz ${{ github.workspace }}/
- name: Create archive (Windows)
if: matrix.archive == 'zip'
shell: pwsh
run: |
cd target/${{ matrix.target }}/release
Compress-Archive -Path "arkdrop.exe" -DestinationPath "${{ github.workspace }}/${{ steps.archive.outputs.name }}.zip"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.archive.outputs.name }}
path: ${{ steps.archive.outputs.name }}.${{ matrix.archive }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set version
id: version
run: |
VERSION="$GITHUB_RUN_ID"
TAG_NAME="arkdrop-v${VERSION}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "tag=${TAG_NAME}" >> $GITHUB_OUTPUT
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create release notes
id: release_notes
run: |
cat > release_notes.md << 'EOF'
## ARK Drop CLI ${{ steps.version.outputs.version }}
### Downloads
Choose the appropriate binary for your platform:
#### Linux
- **x86_64 (glibc)**: `arkdrop-${{ steps.version.outputs.version }}-x86_64-unknown-linux-gnu.tar.gz`
- **x86_64 (musl)**: `arkdrop-${{ steps.version.outputs.version }}-x86_64-unknown-linux-musl.tar.gz`
- **ARM64 (glibc)**: `arkdrop-${{ steps.version.outputs.version }}-aarch64-unknown-linux-gnu.tar.gz`
- **ARM64 (musl)**: `arkdrop-${{ steps.version.outputs.version }}-aarch64-unknown-linux-musl.tar.gz`
- **ARMv7 (glibc)**: `arkdrop-${{ steps.version.outputs.version }}-armv7-unknown-linux-gnueabihf.tar.gz`
- **ARMv7 (musl)**: `arkdrop-${{ steps.version.outputs.version }}-armv7-unknown-linux-musleabihf.tar.gz`
#### Windows
- **x86_64**: `arkdrop-${{ steps.version.outputs.version }}-x86_64-pc-windows-msvc.zip`
- **x86**: `arkdrop-${{ steps.version.outputs.version }}-i686-pc-windows-msvc.zip`
- **ARM64**: `arkdrop-${{ steps.version.outputs.version }}-aarch64-pc-windows-msvc.zip`
#### macOS
- **Intel (x86_64)**: `arkdrop-${{ steps.version.outputs.version }}-x86_64-apple-darwin.tar.gz`
- **Apple Silicon (ARM64)**: `arkdrop-${{ steps.version.outputs.version }}-aarch64-apple-darwin.tar.gz`
### Installation
1. Download the appropriate binary for your platform
2. Extract the archive
3. Move the binary to a location in your PATH (e.g., `/usr/local/bin` on Unix systems)
4. Make it executable (Unix systems): `chmod +x arkdrop`
### Usage
Run `arkdrop --help` to see available commands and options.
EOF
- name: Create or update release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.tag }}
name: ARK Drop CLI ${{ steps.version.outputs.version }}
body_path: release_notes.md
files: artifacts/arkdrop-*/*
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}