name: Build Release Artifacts on: push: tags: - 'v*' jobs: build-python-package: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v5 with: enable-cache: true - name: Set up Python uses: actions/setup-python@v5 with: python-version-file: ".python-version" - name: Build memora package run: | cd memora uv build - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: python-memora-dist path: memora/dist/* retention-days: 30 build-rust-cli: runs-on: ${{ matrix.os }} strategy: matrix: include: - os: ubuntu-latest target: x86_64-unknown-linux-gnu artifact_name: memora asset_name: memora-linux-amd64 - os: macos-latest target: x86_64-apple-darwin artifact_name: memora asset_name: memora-darwin-amd64 - os: macos-latest target: aarch64-apple-darwin artifact_name: memora asset_name: memora-darwin-arm64 steps: - uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - name: Cache cargo registry uses: actions/cache@v4 with: path: ~/.cargo/registry key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - name: Cache cargo index uses: actions/cache@v4 with: path: ~/.cargo/git key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - name: Cache cargo build uses: actions/cache@v4 with: path: memora-cli/target key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - name: Build working-directory: memora-cli run: cargo build --release --target ${{ matrix.target }} - name: Prepare artifact run: | mkdir -p artifacts cp memora-cli/target/${{ matrix.target }}/release/${{ matrix.artifact_name }} artifacts/${{ matrix.asset_name }} chmod +x artifacts/${{ matrix.asset_name }} - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: rust-cli-${{ matrix.asset_name }} path: artifacts/${{ matrix.asset_name }} retention-days: 30 build-control-plane: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' cache-dependency-path: memora-control-plane/package-lock.json - name: Install dependencies working-directory: ./memora-control-plane run: npm ci - name: Build Next.js app working-directory: ./memora-control-plane run: npm run build - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: control-plane-build path: | memora-control-plane/.next/standalone memora-control-plane/.next/static retention-days: 30 build-docker-images: runs-on: ubuntu-latest strategy: matrix: component: [api, control-plane] steps: - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Extract version from tag id: get_version run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - name: Build Docker image (api) if: matrix.component == 'api' uses: docker/build-push-action@v6 with: context: . file: docker/api.Dockerfile push: false tags: memora-api:${{ steps.get_version.outputs.VERSION }} cache-from: type=gha cache-to: type=gha,mode=max outputs: type=docker,dest=/tmp/memora-api.tar - name: Build Docker image (control-plane) if: matrix.component == 'control-plane' uses: docker/build-push-action@v6 with: context: . file: docker/control-plane.Dockerfile push: false tags: memora-control-plane:${{ steps.get_version.outputs.VERSION }} cache-from: type=gha cache-to: type=gha,mode=max outputs: type=docker,dest=/tmp/memora-control-plane.tar - name: Upload Docker image artifact uses: actions/upload-artifact@v4 with: name: docker-image-${{ matrix.component }} path: /tmp/memora-${{ matrix.component }}.tar retention-days: 30 package-helm-chart: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Helm uses: azure/setup-helm@v4 with: version: 'latest' - name: Lint Helm chart run: | helm lint helm/memora - name: Package Helm chart run: | helm package helm/memora --destination ./helm-packages - name: Upload Helm chart artifact uses: actions/upload-artifact@v4 with: name: helm-chart path: helm-packages/*.tgz retention-days: 30 create-github-release: runs-on: ubuntu-latest needs: [build-python-package, build-rust-cli, build-control-plane, build-docker-images, package-helm-chart] permissions: contents: write steps: - uses: actions/checkout@v4 - name: Extract version from tag id: get_version run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - name: Download all artifacts uses: actions/download-artifact@v4 with: path: ./artifacts - name: Prepare release assets run: | mkdir -p release-assets # Python package cp artifacts/python-memora-dist/* release-assets/ # Rust CLI binaries cp artifacts/rust-cli-memora-linux-amd64/memora-linux-amd64 release-assets/ cp artifacts/rust-cli-memora-darwin-amd64/memora-darwin-amd64 release-assets/ cp artifacts/rust-cli-memora-darwin-arm64/memora-darwin-arm64 release-assets/ # Helm chart cp artifacts/helm-chart/*.tgz release-assets/ # Docker images cp artifacts/docker-image-api/memora-api.tar release-assets/ cp artifacts/docker-image-control-plane/memora-control-plane.tar release-assets/ # Control plane build cd artifacts/control-plane-build tar czf ../../release-assets/memora-control-plane-build.tar.gz . cd ../.. - name: Generate release notes id: release_notes run: | cat << EOF > release-notes.md # Memora v${{ steps.get_version.outputs.VERSION }} ## 📦 Release Artifacts ### Python Package - \`memora-${{ steps.get_version.outputs.VERSION }}-py3-none-any.whl\` - \`memora-${{ steps.get_version.outputs.VERSION }}.tar.gz\` ### CLI Binaries - \`memora-linux-amd64\` - Linux x86_64 - \`memora-darwin-amd64\` - macOS Intel - \`memora-darwin-arm64\` - macOS Apple Silicon ### Helm Chart - \`memora-${{ steps.get_version.outputs.VERSION }}.tgz\` ### Docker Images - \`memora-api.tar\` - API server Docker image - \`memora-control-plane.tar\` - Control Plane Docker image ### Control Plane - \`memora-control-plane-build.tar.gz\` - Next.js standalone build ## 🚀 Installation ### Python Package \`\`\`bash pip install memora==${{ steps.get_version.outputs.VERSION }} \`\`\` ### CLI \`\`\`bash # macOS (Apple Silicon) curl -L https://github.com/${{ github.repository }}/releases/download/v${{ steps.get_version.outputs.VERSION }}/memora-darwin-arm64 -o memora chmod +x memora sudo mv memora /usr/local/bin/ # macOS (Intel) curl -L https://github.com/${{ github.repository }}/releases/download/v${{ steps.get_version.outputs.VERSION }}/memora-darwin-amd64 -o memora chmod +x memora sudo mv memora /usr/local/bin/ # Linux curl -L https://github.com/${{ github.repository }}/releases/download/v${{ steps.get_version.outputs.VERSION }}/memora-linux-amd64 -o memora chmod +x memora sudo mv memora /usr/local/bin/ \`\`\` ### Helm Chart \`\`\`bash helm install memora memora-${{ steps.get_version.outputs.VERSION }}.tgz \`\`\` ### Docker \`\`\`bash # Load API image docker load < memora-api.tar # Load Control Plane image docker load < memora-control-plane.tar \`\`\` EOF cat release-notes.md - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: files: release-assets/* body_path: release-notes.md draft: false prerelease: false generate_release_notes: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create release summary run: | echo "# Release v${{ steps.get_version.outputs.VERSION }} Published Successfully" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "## 📦 Components" >> $GITHUB_STEP_SUMMARY echo "- ✅ Python package (memora)" >> $GITHUB_STEP_SUMMARY echo "- ✅ Rust CLI (Linux amd64, macOS amd64, macOS arm64)" >> $GITHUB_STEP_SUMMARY echo "- ✅ Control Plane Next.js application" >> $GITHUB_STEP_SUMMARY echo "- ✅ Docker images (API, Control Plane)" >> $GITHUB_STEP_SUMMARY echo "- ✅ Helm chart" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "🎉 Release is now available at: https://github.com/${{ github.repository }}/releases/tag/v${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY