github.com/oam-dev/cluster-gateway@v1.9.0/.github/workflows/build-image.yml (about)

     1  name: BuildImage
     2  
     3  on:
     4    push:
     5      branches:
     6        - master
     7        - release-*
     8      tags:
     9        - 'v*'
    10    workflow_dispatch: {}
    11  
    12  jobs:
    13    build-push-image:
    14      runs-on: ubuntu-latest
    15      permissions:
    16        contents: read
    17        packages: write
    18      steps:
    19        - name: Checkout
    20          uses: actions/checkout@v3
    21        - name: Docker meta
    22          id: meta
    23          uses: docker/metadata-action@v4
    24          with:
    25            images: |
    26              oamdev/cluster-gateway
    27              ghcr.io/oam-dev/cluster-gateway
    28            tags: |
    29              type=ref,event=branch
    30              type=ref,event=tag
    31              type=raw,value=latest,enable={{is_default_branch}}
    32        - name: Login docker.io
    33          uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
    34          with:
    35            registry: docker.io
    36            username: ${{ secrets.DOCKER_USER }}
    37            password: ${{ secrets.DOCKER_PASSWORD }}
    38        - name: Login to GitHub Container Registry
    39          uses: docker/login-action@v2
    40          with:
    41            registry: ghcr.io
    42            username: ${{ github.repository_owner }}
    43            password: ${{ secrets.GITHUB_TOKEN }}
    44  
    45        - name: Set up Docker Buildx
    46          uses: docker/setup-buildx-action@v2
    47  
    48        - name: Build and push
    49          uses: docker/build-push-action@v4
    50          with:
    51            context: .
    52            platforms: linux/amd64,linux/arm64
    53            file: ./cmd/apiserver/Dockerfile
    54            push: true
    55            tags: ${{ steps.meta.outputs.tags }}
    56            labels: ${{ steps.meta.outputs.labels }}
    57            cache-from: type=gha
    58            cache-to: type=gha,mode=max