github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/.github/workflows/build_image_amd64.yml (about)

     1  name: build_image_linux_amd64
     2  
     3  on:
     4    push:
     5      branches: ["main"]
     6      tags: ["v*.*.*"]
     7    pull_request:
     8      branches: ["main"]
     9    schedule:
    10      - cron: "0 18 * * *"
    11  
    12  env:
    13    REGISTRY: ghcr.io
    14    IMAGE_NAME: ${{ github.repository }}
    15  
    16  jobs:
    17    build_docker_image:
    18      runs-on: ${{ matrix.os }}
    19      strategy:
    20        fail-fast: false
    21        matrix:
    22          os: [ubuntu-latest]
    23      permissions:
    24        contents: read
    25        packages: write
    26        id-token: write
    27  
    28      steps:
    29        - uses: actions/checkout@v3
    30          with:
    31            ref: ${{ github.event.pull_request.head.sha }}
    32            fetch-depth: 0
    33  
    34        - name: Set up QEMU
    35          #if: startsWith(matrix.os, 'macos-latest') != true
    36          uses: docker/setup-qemu-action@v2
    37  
    38        - name: Setup Docker buildx
    39          uses: docker/setup-buildx-action@v2
    40  
    41        - name: Log into registry ${{ env.REGISTRY }}
    42          if: github.event_name != 'pull_request'
    43          uses: docker/login-action@v2
    44          with:
    45            registry: ${{ env.REGISTRY }}
    46            username: ${{ github.actor }}
    47            password: ${{ secrets.GITHUB_TOKEN }}
    48  
    49        - name: Extract Docker metadata
    50          id: meta
    51          uses: docker/metadata-action@v4
    52          with:
    53            images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
    54  
    55        - name: Build and push Docker image
    56          id: build-and-push
    57          uses: docker/build-push-action@v4
    58          with:
    59            context: .
    60            file: ./cmd/srv-applet-mgr/Dockerfile
    61            platforms: linux/amd64
    62            push: ${{ github.event_name != 'pull_request' }}
    63            tags: ${{ steps.meta.outputs.tags }}
    64            labels: ${{ steps.meta.outputs.labels }}
    65            cache-from: type=gha
    66            cache-to: type=gha,mode=max