name: Build and Push Docker Image on: push: branches: - main - "codex/**" pull_request: branches: - main workflow_dispatch: jobs: build-and-push: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout uses: actions/checkout@v4 - name: Run runtime tests run: | python3 -m unittest discover -s tests -v python3 -m compileall plugins patches tests - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Docker metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/domfelipe/hermes-agent-custom tags: | type=raw,value=latest,enable={{is_default_branch}} type=ref,event=branch type=ref,event=pr type=sha - name: Login to GitHub Container Registry if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and Push uses: docker/build-push-action@v5 with: context: . push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}