Skip to content

Merge pull request #9 from intelliDean/fix-studio-embedding #6

Merge pull request #9 from intelliDean/fix-studio-embedding

Merge pull request #9 from intelliDean/fix-studio-embedding #6

Workflow file for this run

# ─────────────────────────────────────────────────────────────────────────────
# Atupa Release β€” Automated Binary Compilation & Publishing
#
# Triggered when a new version tag (v*) is pushed.
# Performs a cross-platform matrix build (Linux, macOS, Windows),
# bundles the Studio frontend into the binary, and creates a GitHub Release.
# ─────────────────────────────────────────────────────────────────────────────
name: πŸš€ Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
# ── Phase 1: Create the Release Draft ──────────────────────────────────────
create-release:
name: πŸ“ Create GitHub Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: false
generate_release_notes: true
# ── Phase 2: Build Binaries (Matrix) ───────────────────────────────────────
build-binaries:
name: πŸ› οΈ Build for ${{ matrix.target }}
needs: create-release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
artifact_name: atupa-linux-x86_64
asset_name: atupa-linux-x86_64.tar.gz
- target: aarch64-apple-darwin
os: macos-latest
artifact_name: atupa-macos-arm64
asset_name: atupa-macos-arm64.tar.gz
- target: x86_64-apple-darwin
os: macos-latest
artifact_name: atupa-macos-x86_64
asset_name: atupa-macos-x86_64.tar.gz
- target: x86_64-pc-windows-msvc
os: windows-latest
artifact_name: atupa-windows-x64
asset_name: atupa-windows-x64.zip
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
with:
key: atupa-release-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: 'studio/package-lock.json'
# 🎨 Studio Frontend must be built for the binary to embed it
- name: Build Atupa Studio
shell: bash
run: |
cd studio
npm install
npm run build
- name: Build Atupa CLI
shell: bash
run: cargo build --release --target ${{ matrix.target }} -p atupa
# πŸ“¦ Packaging
- name: Package Binary (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../${{ matrix.asset_name }} atupa
cd ../../../
- name: Package Binary (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd target/${{ matrix.target }}/release
Compress-Archive -Path atupa.exe -DestinationPath ../../../${{ matrix.asset_name }}
cd ../../../
# πŸš€ Upload to the release created in Phase 1
- name: Upload Asset to Release
uses: softprops/action-gh-release@v2
with:
files: ${{ matrix.asset_name }}
tag_name: ${{ github.ref_name }}
# ── Phase 3: Publish to Crates.io ──────────────────────────────────────────
publish-crates:
name: πŸ“¦ Publish to Crates.io
needs: build-binaries
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Publish Workspace
shell: bash
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: |
if [ -z "$CARGO_REGISTRY_TOKEN" ]; then
echo "⚠️ CRATES_IO_TOKEN not found. Skipping publish step."
exit 0
fi
./publish.sh