name: GitHub App Image
on:
push:
branches: [main]
paths:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- "Dockerfile.github-app"
- "scripts/smoke-github-app-image.sh"
- ".github/workflows/github-app-image.yml"
pull_request:
branches: [main]
paths:
- "src/**"
- "Cargo.toml"
- "Cargo.lock"
- "Dockerfile.github-app"
- "scripts/smoke-github-app-image.sh"
- ".github/workflows/github-app-image.yml"
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build-and-push:
name: Build & Push foxguard-github-app
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.github-app
load: true
push: false
tags: |
ghcr.io/0sec-labs/foxguard-github-app:latest
ghcr.io/0sec-labs/foxguard-github-app:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Smoke test GitHub App container
run: scripts/smoke-github-app-image.sh ghcr.io/0sec-labs/foxguard-github-app:${{ github.sha }}
- name: Push verified GitHub App image
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
run: |
docker push ghcr.io/0sec-labs/foxguard-github-app:${GITHUB_SHA}
docker push ghcr.io/0sec-labs/foxguard-github-app:latest