Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Build Release

on:
push:
tags:
- "v*"

permissions:
contents: write
id-token: write
attestations: write

jobs:

build:

strategy:
fail-fast: false

matrix:
include:

- os: ubuntu-latest
target_os: linux
arch: amd64
rust_target: x86_64-unknown-linux-gnu

- os: ubuntu-latest
target_os: linux
arch: arm64
rust_target: aarch64-unknown-linux-gnu

- os: windows-latest
target_os: windows
arch: x64
rust_target: x86_64-pc-windows-msvc

- os: windows-latest
target_os: windows
arch: arm64
rust_target: aarch64-pc-windows-msvc

- os: macos-13
target_os: macos
arch: x64
rust_target: x86_64-apple-darwin

- os: macos-14
target_os: macos
arch: arm64
rust_target: aarch64-apple-darwin

runs-on: ${{ matrix.os }}

steps:

- name: Checkout
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_target }}

- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y ruby ruby-dev rpm
sudo gem install fpm
cargo install cargo-cyclonedx || true

- name: Install Windows Dependencies
if: runner.os == 'Windows'
run: |
choco install nsis -y

- name: Build
shell: bash
run: |
chmod +x build.sh

export RUST_TARGET="${{ matrix.rust_target }}"

./build.sh

- name: Package
shell: bash
run: |
chmod +x package.sh

VERSION=${GITHUB_REF#refs/tags/v}

./package.sh \
"$VERSION" \
"${{ matrix.target_os }}" \
"${{ matrix.arch }}"

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target_os }}-${{ matrix.arch }}
path: target/**

release:

needs: build

runs-on: ubuntu-latest

steps:

- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Create Release
uses: softprops/softprops/gh-release@v2
with:
files: artifacts/**/*

- name: Generate Provenance
uses: actions/attest-build-provenance@v2
with:
subject-path: artifacts/**/*
112 changes: 112 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/usr/bin/env bash

set -euo pipefail

PROJECT_NAME="OmegaCode"

ROOT_DIR="$(pwd)"

CONSOLE_UI_DIR="$ROOT_DIR/console/console-ui"
CONSOLE_PANEL_DIR="$ROOT_DIR/console/console-panel"
MCP_SERVER_DIR="$ROOT_DIR/mcp-server"

BUILD_DIR="$ROOT_DIR/build"
BUNDLE_DIR="$BUILD_DIR/release_bundle"

RUST_TARGET="${RUST_TARGET:-}"

echo "=================================="
echo "Build Started"
echo "=================================="

rm -rf "$BUILD_DIR"
mkdir -p "$BUNDLE_DIR"

echo "[UI] Building"

pushd "$CONSOLE_UI_DIR"

npm ci
npm run build

if [ ! -d dist ]; then
echo "dist directory not found"
exit 1
fi

popd

echo "[JAVA] Building"

pushd "$CONSOLE_PANEL_DIR"

mvn -B clean package

PANEL_JAR=$(find target -type f -name "*.jar" \
! -name "*sources.jar" \
! -name "*javadoc.jar" \
| head -n 1)

if [ ! -f "$PANEL_JAR" ]; then
echo "Jar not found"
exit 1
fi

popd

echo "[RUST] Building"

if [ -n "$RUST_TARGET" ]; then

cargo build \
--release \
--target "$RUST_TARGET"

RELEASE_DIR="$ROOT_DIR/target/$RUST_TARGET/release"

else

cargo build --release

RELEASE_DIR="$ROOT_DIR/target/release"

fi

EXECUTABLE="$RELEASE_DIR/OmegaCode"

if [ -f "$EXECUTABLE.exe" ]; then
EXECUTABLE="$EXECUTABLE.exe"
fi

if [ ! -f "$EXECUTABLE" ]; then
echo "OmegaCode executable not found"
exit 1
fi

echo "[BUNDLE]"

mkdir -p "$BUNDLE_DIR/ui"

cp "$EXECUTABLE" \
"$BUNDLE_DIR/"

cp "$PANEL_JAR" \
"$BUNDLE_DIR/console_panel.jar"

cp -R "$CONSOLE_UI_DIR/dist/"* \
"$BUNDLE_DIR/ui/"

cp -R "$MCP_SERVER_DIR" \
"$BUNDLE_DIR/"

mkdir -p "$BUNDLE_DIR/sbom"

if command -v cargo-cyclonedx >/dev/null 2>&1; then
cargo cyclonedx \
--format json \
--output-file "$BUNDLE_DIR/sbom/rust-bom.json" || true
fi

echo "Build Finished"

find "$BUNDLE_DIR"
15 changes: 15 additions & 0 deletions console/console-panel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,21 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-maven-plugin</artifactId>
<version>2.9.1</version>

<executions>
<execution>
<phase>package</phase>
<goals>
<goal>makeAggregateBom</goal>
</goals>
</execution>
</executions>

</plugin>
</plugins>
</build>

Expand Down
28 changes: 28 additions & 0 deletions installer.nsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
!define PRODUCT_NAME "OmegaCode"

OutFile "${PRODUCT_NAME}_${VERSION}_windows_${ARCH}.exe"

InstallDir "$PROGRAMFILES64\OmegaCode"

RequestExecutionLevel admin

Page directory
Page instfiles

Section

SetOutPath "$INSTDIR"

File /r "build\release_bundle\*"

WriteUninstaller "$INSTDIR\uninstall.exe"

SectionEnd

Section "Uninstall"

Delete "$INSTDIR\uninstall.exe"

RMDir /r "$INSTDIR"

SectionEnd
87 changes: 87 additions & 0 deletions package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env bash

set -euo pipefail

VERSION="$1"
TARGET_OS="$2"
TARGET_ARCH="$3"

PROJECT_NAME="OmegaCode"

ROOT_DIR="$(pwd)"

BUILD_DIR="$ROOT_DIR/build"
BUNDLE_DIR="$BUILD_DIR/release_bundle"

OUTPUT_DIR="$ROOT_DIR/target/${PROJECT_NAME}-${VERSION}"

mkdir -p "$OUTPUT_DIR"

echo "Packaging..."
echo "Version : $VERSION"
echo "OS : $TARGET_OS"
echo "Arch : $TARGET_ARCH"

tar -czf \
"$OUTPUT_DIR/${PROJECT_NAME}_${VERSION}_${TARGET_OS}_${TARGET_ARCH}.tar.gz" \
-C "$BUILD_DIR" \
release_bundle

if [ "$TARGET_OS" = "linux" ]; then

fpm \
-s dir \
-t deb \
-n "$PROJECT_NAME" \
-v "$VERSION" \
--architecture "$TARGET_ARCH" \
"$BUNDLE_DIR=/usr/local/OmegaCode"

mv ./*.deb "$OUTPUT_DIR/" 2>/dev/null || true

fpm \
-s dir \
-t rpm \
-n "$PROJECT_NAME" \
-v "$VERSION" \
--architecture "$TARGET_ARCH" \
"$BUNDLE_DIR=/usr/local/OmegaCode"

mv ./*.rpm "$OUTPUT_DIR/" 2>/dev/null || true

fi

if [ "$TARGET_OS" = "windows" ]; then

makensis \
-DVERSION="$VERSION" \
-DARCH="$TARGET_ARCH" \
installer.nsi

mv ./*.exe "$OUTPUT_DIR/" 2>/dev/null || true

fi

if [ "$TARGET_OS" = "macos" ]; then

DMG_NAME="${PROJECT_NAME}_${VERSION}_macOS_${TARGET_ARCH}.dmg"

hdiutil create \
-volname "$PROJECT_NAME" \
-srcfolder "$BUNDLE_DIR" \
-ov \
-format UDZO \
"$OUTPUT_DIR/$DMG_NAME"

fi

if [ -d "$BUNDLE_DIR/sbom" ]; then

tar -czf \
"$OUTPUT_DIR/${PROJECT_NAME}_${VERSION}_sbom.tar.gz" \
-C "$BUNDLE_DIR" \
sbom

fi

echo "Packaging Finished"
Loading