Skip to content

radar-agent-built

radar-agent-built #17

Workflow file for this run

name: Build and Release Agent
env:
REGISTRY: ghcr.io
IMAGE_NAME: redis-field-engineering/radar-agent
permissions:
contents: write
packages: write
on:
repository_dispatch:
types: [radar-agent-built]
jobs:
copy-binaries:
name: Download Binaries from Radar Repo
runs-on: ubuntu-latest
steps:
- name: Checkout radar-agent repo
uses: actions/checkout@v4
- name: Download binaries from radar repository workflow
uses: dawidd6/action-download-artifact@v3
with:
github_token: ${{ secrets.RADAR_AGENT_TOKEN }}
run_id: ${{ github.event.client_payload.workflow_run_id }}
repo: redis-field-engineering/radar
path: ./binaries
- name: Prepare binaries for Docker build and release
run: |
# Copy all binaries to root for consistent access
cp ./binaries/radar-agent-linux/radar-agent-linux ./radar-agent-linux
cp ./binaries/radar-agent-linux-musl/radar-agent-linux-musl ./radar-agent-linux-musl
cp ./binaries/radar-agent-linux-arm64/radar-agent-linux-arm64 ./radar-agent-linux-arm64
radar-agent-linux-arm64-musl
cp ./binaries/radar-agent-linux-arm64-musl/radar-agent-linux-arm64-musl ./radar-agent-linux-arm64-musl
cp ./binaries/radar-agent-darwin/radar-agent-darwin ./radar-agent-darwin
# Make binaries executable
chmod +x radar-agent-*
# Log what we received
echo "✅ Downloaded binaries for tag: ${{ github.event.client_payload.ref }}"
# Verify binaries
ls -la radar-agent-*
- name: Upload binaries for Docker build and release
uses: actions/upload-artifact@v4
with:
name: agent-binaries
path: |
radar-agent-linux
radar-agent-linux-musl
radar-agent-linux-arm64
radar-agent-linux-arm64-musl
radar-agent-darwin
retention-days: 1
docker:
name: Build and Push Docker Images
needs: [copy-binaries]
runs-on: ubuntu-latest
steps:
- name: Checkout radar-agent repo
uses: actions/checkout@v4
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: agent-binaries
path: ./
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
org.opencontainers.image.source=https://github.com/redis-field-engineering/radar-agent
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Get tag name
id: tag
run: |
echo "tag_name=${{ github.event.client_payload.ref }}" >> $GITHUB_OUTPUT
- name: Build and push multi-platform Debian image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile.multiplatform
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag_name }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:debian-${{ steps.tag.outputs.tag_name }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:debian-latest
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
- name: Build and push multi-platform Alpine image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile.alpine.multiplatform
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-${{ steps.tag.outputs.tag_name }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:alpine-latest
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
release:
name: Create Release
needs: [docker]
runs-on: ubuntu-latest
steps:
- name: Checkout radar-agent repo
uses: actions/checkout@v4
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: agent-binaries
path: ./
- name: Get tag name
id: tag
run: |
echo "tag_name=${{ github.event.client_payload.ref }}" >> $GITHUB_OUTPUT
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
- name: Create signed tag for this repository
run: |
# Create and explicitly sign the tag with -s flag
git tag -s ${{ steps.tag.outputs.tag_name }} -m "Release ${{ steps.tag.outputs.tag_name }}" --force
# Push the signed tag to the repository
git push origin ${{ steps.tag.outputs.tag_name }} --force
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.tag_name }}
name: "Radar Agent ${{ steps.tag.outputs.tag_name }}"
files: |
radar-agent-linux
radar-agent-linux-musl
radar-agent-linux-arm64
radar-agent-linux-arm64-musl
radar-agent-darwin
make_latest: true
body: |
## Radar Agent Release ${{ steps.tag.outputs.tag_name }}
### Quick Install
**Linux AMD64 (glibc):**
```bash
curl -L "https://github.com/redis-field-engineering/radar-agent/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-linux" -o radar-agent
```
**Linux AMD64 (musl):**
```bash
curl -L "https://github.com/redis-field-engineering/radar-agent/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-linux-musl" -o radar-agent
```
**Linux ARM64 (glibc):**
**Linux ARM64 (musl - for Alpine):**
```bash
curl -L "https://github.com/redis-field-engineering/radar-agent/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-linux-arm64-musl" -o radar-agent
```
```bash
curl -L "https://github.com/redis-field-engineering/radar-agent/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-linux-arm64" -o radar-agent
```
**macOS (Apple Silicon):**
```bash
curl -L "https://github.com/redis-field-engineering/radar-agent/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-darwin" -o radar-agent
```
**Install binary:**
```bash
chmod +x radar-agent
sudo cp radar-agent /usr/local/bin/radar-agent
```
**Docker (Multi-Platform - AMD64 & ARM64):**
```bash
# Latest (Debian-based, works on both AMD64 and ARM64)
docker pull ghcr.io/redis-field-engineering/radar-agent:latest
# Specific version
docker pull ghcr.io/redis-field-engineering/radar-agent:${{ steps.tag.outputs.tag_name }}
# Alpine (recommended for minimal size)
docker pull ghcr.io/redis-field-engineering/radar-agent:alpine-latest
# Debian
docker pull ghcr.io/redis-field-engineering/radar-agent:debian-latest
```
### Platform Support
- **AMD64 (x86_64)**: All binaries and Docker images
- **ARM64 (aarch64)**: Native binary + multi-platform Docker images
- **Apple Silicon (M1/M2/M3)**: Native macOS binary + ARM64 Docker images
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}