Skip to content

Merge pull request #608 from PrimeIntellect-ai/release/0.3.10 #455

Merge pull request #608 from PrimeIntellect-ai/release/0.3.10

Merge pull request #608 from PrimeIntellect-ai/release/0.3.10 #455

Workflow file for this run

name: Development Release
on:
push:
branches:
- develop
tags-ignore:
- '*'
permissions:
contents: write
discussions: write
packages: write
jobs:
build-and-release:
name: Build and Create Development Release
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Generate next version number
id: next_version
run: |
# Get the latest production version (e.g., v0.1.7)
LATEST_PROD=$(git tag --list "v*" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n1 || echo "v0.1.7")
# Compute next version (increment the patch version)
NEXT_PROD=$(echo "$LATEST_PROD" | awk -F. -v OFS=. '{$NF++; print}')
# Find the last beta version and increment it, or start at beta.1 if none exists
LAST_BETA=$(git tag --list "${NEXT_PROD}-beta.*" | sort -V | tail -n1)
# If there is no existing beta version, start from beta.1
if [ -z "$LAST_BETA" ]; then
COUNT=1
else
COUNT=$(echo $LAST_BETA | sed 's/.*beta\.\([0-9]*\)/\1/')
COUNT=$((COUNT + 1))
fi
TAG_NAME="${NEXT_PROD}-beta.${COUNT}"
echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT
# Use all available cores for the build
- name: Build all workspace members
env:
WORKER_VERSION: ${{ steps.next_version.outputs.tag_name }}
run: |
export CARGO_BUILD_JOBS=$(nproc)
cargo build --release --workspace
- name: Prepare binaries
run: |
mkdir -p release-artifacts
if [ -f target/release/worker ]; then
cp target/release/worker release-artifacts/worker-linux-x86_64
fi
if [ -f target/release/validator ]; then
cp target/release/validator release-artifacts/validator-linux-x86_64
fi
if [ -f target/release/orchestrator ]; then
cp target/release/orchestrator release-artifacts/orchestrator-linux-x86_64
fi
if [ -f target/release/discovery ]; then # Prepare discovery binary
cp target/release/discovery release-artifacts/discovery-linux-x86_64
fi
- name: Generate checksums
run: |
cd release-artifacts
for file in *-linux-x86_64; do
if [ -f "$file" ]; then
sha256sum "$file" | cut -d ' ' -f 1 > "${file}.checksum"
fi
done
cd ..
- name: Create development tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
TAG_NAME=${{ steps.next_version.outputs.tag_name }}
if git tag --list "$TAG_NAME" | grep -q "$TAG_NAME"; then
echo "Tag $TAG_NAME already exists. Skipping tag creation."
else
git tag "$TAG_NAME"
git push origin "$TAG_NAME"
fi
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
# Setup Google Cloud SDK
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: Upload binaries to GCS
run: |
# Upload binaries to versioned folder
gsutil -m cp release-artifacts/* gs://protocol-repo-assets/builds/${{ steps.next_version.outputs.tag_name }}/
# Also upload to 'latest' for easy access to newest dev build
gsutil -m cp release-artifacts/* gs://protocol-repo-assets/builds/latest/
echo "Binaries uploaded to:"
echo "- gs://protocol-repo-assets/builds/${{ steps.next_version.outputs.tag_name }}/"
echo "- gs://protocol-repo-assets/builds/latest/"
- name: Generate Docker metadata
id: meta
run: |
REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
echo "repo_lower=${REPO_LOWER}" >> $GITHUB_OUTPUT
- name: Configure Docker for Artifact Registry
run: |
gcloud auth configure-docker us-east1-docker.pkg.dev
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Discovery image
uses: docker/build-push-action@v4
with:
context: .
file: ./crates/discovery/Dockerfile
push: true
tags: |
ghcr.io/${{ steps.meta.outputs.repo_lower }}/discovery:dev
ghcr.io/${{ steps.meta.outputs.repo_lower }}/discovery:${{ steps.next_version.outputs.tag_name }}
us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/discovery:dev
us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/discovery:${{ steps.next_version.outputs.tag_name }}
- name: Build and push Validator image
uses: docker/build-push-action@v4
with:
context: .
file: ./crates/validator/Dockerfile
push: true
tags: |
ghcr.io/${{ steps.meta.outputs.repo_lower }}/validator:dev
ghcr.io/${{ steps.meta.outputs.repo_lower }}/validator:${{ steps.next_version.outputs.tag_name }}
us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/validator:dev
us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/validator:${{ steps.next_version.outputs.tag_name }}
- name: Build and push Orchestrator image
uses: docker/build-push-action@v4
with:
context: .
file: ./crates/orchestrator/Dockerfile
push: true
tags: |
ghcr.io/${{ steps.meta.outputs.repo_lower }}/orchestrator:dev
ghcr.io/${{ steps.meta.outputs.repo_lower }}/orchestrator:${{ steps.next_version.outputs.tag_name }}
us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/orchestrator:dev
us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/orchestrator:${{ steps.next_version.outputs.tag_name }}