radar-agent-built #1
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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 | |
| run: | | |
| # Copy binaries to expected locations | |
| 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 | |
| # Make binaries executable | |
| chmod +x radar-agent-linux radar-agent-linux-musl | |
| # 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 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: agent-binaries | |
| path: | | |
| radar-agent-linux | |
| radar-agent-linux-musl | |
| 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 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 Debian image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./docker/Dockerfile | |
| build-args: | | |
| BINARY=./radar-agent-linux | |
| push: true | |
| tags: | | |
| ${{ 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 | |
| - name: Build and push Alpine image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./docker/Dockerfile.alpine | |
| build-args: | | |
| BINARY=./radar-agent-linux-musl | |
| 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 | |
| release: | |
| name: Create Release | |
| needs: [docker] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Get tag name | |
| id: tag | |
| run: | | |
| echo "tag_name=${{ github.event.client_payload.tag }}" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.tag_name }} | |
| name: "Radar Agent ${{ steps.tag.outputs.tag_name }}" | |
| body: | | |
| ## Radar Agent Release ${{ steps.tag.outputs.tag_name }} | |
| ### Quick Install | |
| **Linux (glibc):** | |
| ```bash | |
| curl -L "https://github.com/redis-field-engineering/radar/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-linux" -o radar-agent | |
| ``` | |
| **Linux (musl):** | |
| ```bash | |
| curl -L "https://github.com/redis-field-engineering/radar/releases/download/${{ steps.tag.outputs.tag_name }}/radar-agent-linux-musl" -o radar-agent | |
| ``` | |
| **macOS:** | |
| ```bash | |
| curl -L "https://github.com/redis-field-engineering/radar/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:** | |
| ```bash | |
| # Alpine (recommended) | |
| docker pull ghcr.io/redis-field-engineering/radar-agent:alpine-${{ steps.tag.outputs.tag_name }} | |
| # Debian | |
| docker pull ghcr.io/redis-field-engineering/radar-agent:debian-${{ steps.tag.outputs.tag_name }} | |
| ``` | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |