github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/.github/workflows/dockerimage.yml (about)

     1  name: docker-image
     2  
     3  on:
     4    push:
     5      branches:
     6        - master
     7      tags:
     8        - v*
     9  
    10  jobs:
    11    publish:
    12      runs-on: ubuntu-latest
    13      steps:
    14        - name: checkout
    15          uses: actions/checkout@v4
    16          with:
    17            fetch-depth: 0
    18  
    19        - uses: docker/setup-qemu-action@v3
    20        - uses: docker/setup-buildx-action@v3
    21  
    22        - name: Log in to the ghcr
    23          uses: docker/login-action@v3
    24          with:
    25            registry: ghcr.io
    26            username: ${{ github.actor }}
    27            password: ${{ secrets.GITHUB_TOKEN }}
    28  
    29        - name: Log in to the docker
    30          uses: docker/login-action@v3
    31          with:
    32            username: ${{ secrets.DOCKER_USERNAME }}
    33            password: ${{ secrets.DOCKER_PASSWORD }}
    34  
    35        - name: Docker meta
    36          id: meta
    37          uses: docker/metadata-action@v5
    38          with:
    39            images: |
    40              ghcr.io/${{ github.repository }}
    41              ${{ github.repository }}
    42            tags: |
    43              type=ref,event=tag
    44  
    45        - name: Docker meta for debug version
    46          if: ${{ github.ref == 'refs/heads/master' }}
    47          id: debug-meta
    48          uses: docker/metadata-action@v5
    49          with:
    50            images: |
    51              ghcr.io/${{ github.repository }}
    52              ${{ github.repository }}
    53            tags: |
    54              type=sha,format=long,prefix=
    55  
    56        - name: Build and push image
    57          if: ${{ steps.meta.outputs.tags != '' }}
    58          uses: docker/build-push-action@v5
    59          with:
    60            context: "."
    61            platforms: linux/amd64,linux/arm64
    62            push: true
    63            tags: ${{ steps.meta.outputs.tags }}
    64  
    65        - name: "[debug version] Build and push image"
    66          if: ${{ github.ref == 'refs/heads/master' }}
    67          uses: docker/build-push-action@v5
    68          with:
    69            context: "."
    70            platforms: linux/amd64,linux/arm64
    71            push: true
    72            build-args: |
    73              KEEP_SYMBOL=1
    74            tags: ${{ steps.debug-meta.outputs.tags }}