name: Build & Push Image on: push: branches: [main] tags: ["v*"] workflow_dispatch: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository_owner }}/netrunner-control-plane jobs: build: name: Build and push to GHCR runs-on: ubuntu-24.04 permissions: contents: read packages: write steps: - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GHCR uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=raw,value=latest,enable={{is_default_branch}} type=sha,format=long type=ref,event=tag - name: Build and push uses: docker/build-push-action@v6 with: context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} # Кеш слоёв между прогонами — повторные сборки в разы быстрее. cache-from: type=gha cache-to: type=gha,mode=max