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-docker-images: runs-on: ubuntu-latest permissions: contents: read packages: write strategy: matrix: component: [api, control-plane] steps: - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract version from tag id: get_version run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/memora-${{ matrix.component }} tags: | type=semver,pattern={{version}},value=${{ steps.get_version.outputs.VERSION }} type=semver,pattern={{major}}.{{minor}},value=${{ steps.get_version.outputs.VERSION }} type=semver,pattern={{major}},value=${{ steps.get_version.outputs.VERSION }} type=raw,value=latest - name: Build and push Docker image (api) if: matrix.component == 'api' uses: docker/build-push-action@v6 with: context: . file: docker/api.Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - name: Build and push Docker image (control-plane) if: matrix.component == 'control-plane' uses: docker/build-push-action@v6 with: context: . file: docker/control-plane.Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max 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-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/ - 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 Docker images are published to GitHub Container Registry: - \`ghcr.io/${{ github.repository_owner }}/memora-api:${{ steps.get_version.outputs.VERSION }}\` - \`ghcr.io/${{ github.repository_owner }}/memora-control-plane:${{ steps.get_version.outputs.VERSION }}\` ## 🚀 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 # Pull API image docker pull ghcr.io/${{ github.repository_owner }}/memora-api:${{ steps.get_version.outputs.VERSION }} # Pull Control Plane image docker pull ghcr.io/${{ github.repository_owner }}/memora-control-plane:${{ steps.get_version.outputs.VERSION }} # Or use latest docker pull ghcr.io/${{ github.repository_owner }}/memora-api:latest docker pull ghcr.io/${{ github.repository_owner }}/memora-control-plane:latest \`\`\` 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 "- ✅ 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