diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb2beb7..2d3173f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - dev pull_request: branches: - main @@ -83,3 +84,43 @@ jobs: -ldflags "-s -w -X main.Version=ci -X main.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ -o /tmp/podux \ main.go + + # ────────────────────────────────────────────── + # Docker: build & push :dev image (dev branch only) + # ────────────────────────────────────────────── + docker-dev: + name: Docker (dev tag) + if: github.ref == 'refs/heads/dev' && github.event_name == 'push' + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + 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@v6 + with: + context: . + file: Dockerfile + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: ghcr.io/${{ github.repository }}:dev + build-args: | + VERSION=dev + BUILD_TIME=${{ github.event.head_commit.timestamp }} + cache-from: type=gha + cache-to: type=gha,mode=max