1+ name : Publish Agents
2+
3+ # Trigger this workflow when pushing agentbeats/green_agent branch
4+ on :
5+ push :
6+ branches :
7+ - agentbeats/green_agent
8+
9+ jobs :
10+ publish :
11+ runs-on : ubuntu-latest
12+
13+ strategy :
14+ matrix :
15+ include :
16+ # FieldWorkArena agent images
17+ - name : fwa-server
18+ dockerfile : Dockerfile
19+ - name : fwa-test-purple-agent
20+ dockerfile : scenarios/fwa/Dockerfile.purple_agent
21+
22+ # These permissions are required for the workflow to:
23+ # - Read repository contents (checkout code)
24+ # - Write to GitHub Container Registry (push Docker images)
25+ permissions :
26+ contents : read
27+ packages : write
28+
29+ steps :
30+ - name : Checkout repository
31+ uses : actions/checkout@v4
32+
33+ - name : Log in to GitHub Container Registry
34+ uses : docker/login-action@v3
35+ with :
36+ registry : ghcr.io
37+ username : ${{ github.actor }}
38+ # GITHUB_TOKEN is automatically provided by GitHub Actions
39+ # No manual secret configuration needed!
40+ # It has permissions based on the 'permissions' block above
41+ password : ${{ secrets.GITHUB_TOKEN }}
42+
43+ - name : Extract metadata for Docker
44+ id : meta
45+ uses : docker/metadata-action@v5
46+ with :
47+ images : ghcr.io/${{ github.repository }}-${{ matrix.name }}
48+ tags : |
49+ # For tags like v1.0, create tag '1.0'
50+ type=semver,pattern={{version}}
51+ # For tags like v1.0, create tag '1'
52+ type=semver,pattern={{major}}
53+ # For main branch, create tag 'latest'
54+ type=raw,value=latest,enable={{is_default_branch}}
55+ # For PRs, create tag 'pr-123'
56+ type=ref,event=pr
57+
58+ - name : Build and push Docker image (${{ matrix.name }})
59+ id : build
60+ uses : docker/build-push-action@v5
61+ with :
62+ context : .
63+ file : ${{ matrix.dockerfile }}
64+ # Only push if this is a push event (not a PR)
65+ # PRs will build but not push to avoid polluting the registry
66+ push : ${{ github.event_name != 'pull_request' }}
67+ tags : ${{ steps.meta.outputs.tags }}
68+ labels : ${{ steps.meta.outputs.labels }}
69+ # Explicitly build for linux/amd64 (GitHub Actions default)
70+ platforms : linux/amd64
71+
72+ - name : Output image digest
73+ if : github.event_name != 'pull_request'
74+ run : |
75+ echo "## Docker Image Published: ${{ matrix.name }} :rocket:" >> $GITHUB_STEP_SUMMARY
76+ echo "" >> $GITHUB_STEP_SUMMARY
77+ echo "**Tags:** ${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
78+ echo "" >> $GITHUB_STEP_SUMMARY
79+ echo "**Digest:** \`${{ steps.build.outputs.digest }}\`" >> $GITHUB_STEP_SUMMARY
80+ echo "" >> $GITHUB_STEP_SUMMARY
81+ echo "Use this digest in your MANIFEST.json for reproducibility." >> $GITHUB_STEP_SUMMARY
0 commit comments