github.com/cosmos/cosmos-sdk@v0.50.10/.github/workflows/docker.yml (about)

     1  name: Build & Push
     2  # Build & Push builds the simapp docker image on every push to main and
     3  # and pushes the image to https://ghcr.io/cosmos/simapp
     4  on:
     5    pull_request:
     6      paths:
     7        - "Dockerfile"
     8    push:
     9      branches:
    10        - main
    11      tags:
    12        - "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10
    13        - "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5
    14    workflow_dispatch:
    15      inputs:
    16        tags:
    17          description: "SDK version (e.g 0.47.1)"
    18          required: true
    19          type: string
    20  
    21  permissions:
    22    contents: read
    23    packages: write
    24  
    25  env:
    26    # Use docker.io for Docker Hub if empty
    27    REGISTRY: ghcr.io
    28    # github.repository as <account>/<repo>
    29    IMAGE_NAME: cosmos/simapp
    30  
    31  jobs:
    32    build:
    33      runs-on: ubuntu-latest
    34      steps:
    35        - uses: actions/checkout@v3
    36          with:
    37            fetch-depth: 0
    38  
    39        - name: Extract Docker metadata
    40          id: meta
    41          uses: docker/metadata-action@v4
    42          with:
    43            images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
    44            tags: |
    45              type=raw,value=latest,enable={{is_default_branch}}
    46              type=semver,pattern=v{{major}}.{{minor}}
    47              type=semver,pattern={{version}},value=v${{ inputs.tags }},enable=${{ inputs.tags != '' }}
    48            flavor: |
    49              latest=false
    50  
    51        - name: Set up Docker Buildx
    52          uses: docker/setup-buildx-action@v2
    53  
    54        - name: Log into registry ${{ env.REGISTRY }}
    55          if: ${{ github.event_name != 'pull_request' }}
    56          uses: docker/login-action@v2
    57          with:
    58            registry: ${{ env.REGISTRY }}
    59            username: ${{ github.actor }}
    60            password: ${{ secrets.GITHUB_TOKEN }}
    61  
    62        - name: Publish to GitHub Packages
    63          uses: docker/build-push-action@v4
    64          with:
    65            platforms: linux/amd64,linux/arm64
    66            push: ${{ github.event_name != 'pull_request' }}
    67            tags: ${{ steps.meta.outputs.tags }}
    68            cache-from: type=gha
    69            cache-to: type=gha,mode=max