Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions agents/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: 'Agents Production Deployment'
description: 'Promote staging agent image to enterprise feed in GHCR'

inputs:
image_repository:
description: 'Full image repository path (e.g., greenbone/scan-agent-app)'
required: true
staging_version:
description: 'Version tag from staging to promote'
required: true
dry_run:
description: 'Dry run mode - verify only, do not push to production'
required: false
default: 'true'
github_token:
description: 'GitHub token for GHCR access'
required: true

runs:
using: "composite"
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ inputs.github_token }}

- name: Verify and pull staging image
shell: bash
run: |
STAGING_IMAGE="ghcr.io/${{ inputs.image_repository }}:${{ inputs.staging_version }}-staging"
if ! docker manifest inspect "$STAGING_IMAGE" > /dev/null 2>&1; then
echo "Error: Staging image not found: $STAGING_IMAGE"
exit 1
fi
echo "Staging image verified: $STAGING_IMAGE"
if [ "${{ inputs.dry_run }}" = "true" ]; then
echo "DRY RUN MODE - Skipping pull"
else
docker pull $STAGING_IMAGE
fi
echo "STAGING_IMAGE=$STAGING_IMAGE" >> $GITHUB_ENV

- name: Tag and push to GHCR production
if: inputs.dry_run != 'true'
shell: bash
run: |
docker tag $STAGING_IMAGE ghcr.io/${{ inputs.image_repository }}:${{ inputs.staging_version }}
docker tag $STAGING_IMAGE ghcr.io/${{ inputs.image_repository }}:enterprise
docker tag $STAGING_IMAGE ghcr.io/${{ inputs.image_repository }}:latest
docker push ghcr.io/${{ inputs.image_repository }}:${{ inputs.staging_version }}
docker push ghcr.io/${{ inputs.image_repository }}:enterprise
docker push ghcr.io/${{ inputs.image_repository }}:latest

- name: Dry run summary for GHCR
if: inputs.dry_run == 'true'
shell: bash
run: |
echo "DRY RUN - Would push to GHCR:"
echo " - ghcr.io/${{ inputs.image_repository }}:${{ inputs.staging_version }}"
echo " - ghcr.io/${{ inputs.image_repository }}:enterprise"
echo " - ghcr.io/${{ inputs.image_repository }}:latest"
Loading