Skip to content

📦 Build CTX Binary #3

📦 Build CTX Binary

📦 Build CTX Binary #3

name: 📦 Build CTX Binary
on:
release:
types:
- published
pull_request:
branches:
- main
jobs:
build-image:
name: 📦 Build and Push Builder Image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: arm64,amd64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
if: github.event_name == 'release'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Builder Image
id: builder-metadata
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/php-builder
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
- name: Build and Push Builder Image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.builder-metadata.outputs.tags }}
labels: ${{ steps.builder-metadata.outputs.labels }}
cache-from: type=gha,scope=builder-image
cache-to: type=gha,mode=max,scope=builder-image