name: Release CLI Binaries on: push: tags: - 'v*' workflow_dispatch: inputs: tag: description: 'Release Version Tag (e.g. v1.0.0 or v1.0.1)' required: true type: string permissions: contents: write jobs: build-binaries: name: Build Binary (${{ matrix.target.name }}) runs-on: ${{ matrix.target.os }} strategy: fail-fast: false matrix: target: - os: windows-latest name: windows-x64 artifact_name: ever-brain-windows-x64.exe binary_name: ever-brain.exe - os: macos-latest name: darwin-arm64 artifact_name: ever-brain-darwin-arm64 binary_name: ever-brain - os: ubuntu-latest name: linux-x64 artifact_name: ever-brain-linux-x64 binary_name: ever-brain steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Resolve Version id: vars shell: bash run: | if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then TAG="${{ inputs.tag }}" else TAG="${{ github.ref_name }}" fi # Ensure tag starts with 'v' if [[ "$TAG" != v* ]]; then TAG="v$TAG" fi VERSION="${TAG#v}" echo "tag=$TAG" >> $GITHUB_OUTPUT echo "version=$VERSION" >> $GITHUB_OUTPUT echo "Building Ever-Brain version $VERSION (tag: $TAG)" - name: Setup Node.js 22 uses: actions/setup-node@v4 with: node-version: 22 - name: Enable Corepack & pnpm shell: bash run: | corepack enable corepack prepare pnpm@latest --activate - name: Setup Bun uses: oven-sh/setup-bun@v2 with: bun-version: latest - name: Install Dependencies run: pnpm install --frozen-lockfile - name: Build Packages run: pnpm build - name: Compile Standalone Binary (${{ matrix.target.name }}) run: | mkdir -p bin bun build ./packages/cli/src/index.ts --compile --minify --target=bun-${{ matrix.target.name }} --outfile ./bin/${{ matrix.target.binary_name }} - name: Prepare Named Release Artifact shell: bash run: | cp ./bin/${{ matrix.target.binary_name }} ./${{ matrix.target.artifact_name }} if [ "${{ matrix.target.os }}" = "windows-latest" ]; then cp ./bin/ever-brain.exe ./ever-brain.exe fi - name: Compile Windows Setup Installer (EverBrainSetup.exe) if: matrix.target.os == 'windows-latest' shell: pwsh run: | if (-not (Get-Command iscc -ErrorAction SilentlyContinue)) { Write-Host "Installing Inno Setup via Chocolatey..." choco install innosetup -y --no-progress $env:Path += ";C:\Program Files (x86)\Inno Setup 6" } $ver = "${{ steps.vars.outputs.version }}" iscc /DMyAppVersion="$ver" scripts/installer.iss /O. - name: Upload Binary Artifact uses: actions/upload-artifact@v4 with: name: ${{ matrix.target.name }} path: | ./${{ matrix.target.artifact_name }} ./ever-brain.exe ./EverBrainSetup.exe if-no-files-found: ignore create-github-release: name: Publish GitHub Release needs: build-binaries runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Download All Built Binaries uses: actions/download-artifact@v4 with: path: ./release-assets merge-multiple: true - name: Resolve Release Tag & Version id: vars shell: bash run: | if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then TAG="${{ inputs.tag }}" else TAG="${{ github.ref_name }}" fi if [[ "$TAG" != v* ]]; then TAG="v$TAG" fi VERSION="${TAG#v}" echo "tag=$TAG" >> $GITHUB_OUTPUT echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Create Release and Upload Assets uses: softprops/action-gh-release@v2 with: tag_name: ${{ steps.vars.outputs.tag }} name: Ever-Brain ${{ steps.vars.outputs.tag }} draft: false prerelease: false generate_release_notes: true files: | ./release-assets/ever-brain-windows-x64.exe ./release-assets/ever-brain.exe ./release-assets/EverBrainSetup.exe ./release-assets/ever-brain-darwin-arm64 ./release-assets/ever-brain-linux-x64 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}