Skip to content

added build workflow #1

added build workflow

added build workflow #1

Workflow file for this run

name: Push CLI Binaries
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
build:
name: Build for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: linux-amd64
env: native
- os: ubuntu-latest
target: linux-musl-aarch64
env: alpine
- os: windows-latest
target: windows-amd64
env: native
- os: ubuntu-latest
target: linux-bionic-aarch64
env: termux
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
# --- NATIVE ENVIRONMENTS (Linux x86_64, Windows x86_64) ---
- name: Set up Python
if: ${{ matrix.env == 'native' }}
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build Native Binaries
if: ${{ matrix.env == 'native' }}
run: |
pip install pyinstaller click rich
if [ "${{ matrix.os }}" = "windows-latest" ]; then
pyinstaller --onefile --name=warpshare-windows-amd64 cli.py
else
pyinstaller --onefile --name=warpshare-linux-amd64 cli.py
fi
# --- ALPINE ENVIROMENT (ARM64 / musl) ---
- name: Set up QEMU Emulation
if: ${{ matrix.env == 'alpine' }}
uses: docker/setup-qemu-action@v3
- name: Build Alpine Binary
if: ${{ matrix.env == 'alpine' }}
run: |
docker run --rm -v ${{ github.workspace }}:/work -w /work arm64v8/alpine:latest sh -c "
apk add --no-cache python3 py3-pip binutils build-essential python3-dev &&
python3 -m venv venv &&
./venv/bin/pip install pyinstaller click rich &&
./venv/bin/pyinstaller --onefile --name=warpshare-linux-musl-aarch64 cli.py
"
# --- TERMUX ENVIRONMENT (ARM64 / bionic) ---
- name: Build Termux Binary
if: ${{ matrix.env == 'termux' }}
run: |
docker run --rm -v ${{ github.workspace }}:/work -w /work termux/termux-docker:aarch64 sh -c "
pkg update && pkg install -y python binutils build-essential clang &&
pip install pyinstaller click rich &&
pyinstaller --onefile --name=warpshare-linux-bionic-aarch64 cli.py
"
# --- STAGE BINARIES ---
- name: Stage Artifacts
run: |
mkdir -p staging_binaries
cp dist/warpshare-* staging_binaries/ 2>/dev/null || cp dist/warpshare-*.exe staging_binaries/ 2>/dev/null
- name: Upload Intermediary Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-raw
path: staging_binaries/
commit-binaries:
name: Commit Binaries to Repository
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download All Built Binaries
uses: actions/download-artifact@v4
with:
path: tmp_binaries
- name: Organize and Commit to Binaries Folder
run: |
mkdir -p binaries
# Flatten downloaded artifacts into the target binaries directory
find tmp_binaries -type f -exec cp {} binaries/ \;
# Configure Git
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Commit modifications directly back to the active repository branch
git add binaries/
if git diff --staged --quiet; then
echo "No new changes detected in compiled binaries."
else
git commit -m "chore: automated compilation update for project binaries [skip ci]"
git push origin HEAD:${{ github.ref_name }}
find