code.vegaprotocol.io/vega@v0.79.0/.github/workflows/release-docker-images.yml (about)

     1  ---
     2  
     3  name: Release vega, data-node and vegawallet docker images
     4  
     5  "on":
     6    push:
     7      branches:
     8        - develop
     9      tags:
    10        - "v*"
    11  
    12    workflow_dispatch:
    13      inputs:
    14        publish:
    15          description: 'Publish tag to Docker Hub & GitHub Registry'
    16          required: false
    17          type: boolean
    18          default: false
    19        tag:
    20          description: 'Git Tag to build and publish'
    21          required: false
    22          type: string
    23          default: ''
    24        apps:
    25          description: 'Applications to build and publish'
    26          required: false
    27          type: choice
    28          options:
    29            - [vega, data-node, vegawallet]
    30            - [vega]
    31            - [data-node]
    32            - [vegawallet]
    33        archs:
    34          description: 'Architecture to build and publish'
    35          required: false
    36          type: choice
    37          options:
    38            - linux/amd64, linux/arm64
    39            - linux/amd64
    40            - linux/arm64
    41  
    42  jobs:
    43    build:
    44      name: Release ${{ matrix.app }} docker image
    45      runs-on: ubuntu-latest
    46      strategy:
    47        fail-fast: false
    48        matrix:
    49          app: ${{ fromJson(inputs.apps || '["vega", "data-node", "vegawallet"]') }}
    50      steps:
    51        - name: Check out code
    52          uses: actions/checkout@v3
    53          with:
    54            ref: ${{ inputs.tag }}
    55  
    56        - name: Set up QEMU
    57          id: quemu
    58          uses: docker/setup-qemu-action@v2
    59  
    60        - name: Available platforms
    61          run: echo ${{ steps.qemu.outputs.platforms }}
    62  
    63        - name: Set up Docker Buildx
    64          uses: docker/setup-buildx-action@v2
    65  
    66        - name: Login to DockerHub
    67          if: ${{ inputs.publish || startsWith(github.ref, 'refs/tags/') }}
    68          uses: docker/login-action@v2
    69          with:
    70            username: ${{ secrets.DOCKERHUB_USERNAME }}
    71            password: ${{ secrets.DOCKERHUB_TOKEN }}
    72  
    73        - name: Log in to the GitHub Container Registry
    74          if: ${{ inputs.publish || startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/develop' }}
    75          uses: docker/login-action@v2
    76          with:
    77            registry: ghcr.io
    78            username: ${{ github.actor }}
    79            password: ${{ secrets.GITHUB_TOKEN }}
    80  
    81        - name: Collect images data
    82          id: tags
    83          run: |
    84            hash=$(git rev-parse HEAD|cut -b1-8)
    85            versionTag=${{ inputs.tag || startsWith(github.ref, 'refs/tags/') && github.ref_name || '${hash}' }}
    86            echo ::set-output name=version::${versionTag}
    87  
    88        - name: Print config
    89          run: |
    90            git rev-parse --verify HEAD
    91            git status
    92            echo "inputs.tag=${{ inputs.tag }}"
    93            echo "inputs.publish=${{ inputs.publish }}"
    94            echo "inputs.apps=${{ inputs.apps }}"
    95            echo "inputs.archs=${{ inputs.archs }}"
    96            echo "steps.tags.outputs.version=${{ steps.tags.outputs.version }}"
    97  
    98        - name: Build and export to local Docker
    99          uses: docker/build-push-action@v3
   100          with:
   101            context: .
   102            push: false
   103            file: ./docker/${{ matrix.app }}.dockerfile
   104            load: true
   105            tags: vegaprotocol/${{ matrix.app }}:local
   106  
   107        - name: Sanity check docker image
   108          run: |
   109            docker run --rm vegaprotocol/${{ matrix.app }}:local version || docker run --rm vegaprotocol/${{ matrix.app }}:local software version
   110  
   111        - name: Build and push to GitHub Container Registry
   112          id: docker_build_github
   113          uses: docker/build-push-action@v3
   114          with:
   115            context: .
   116            push: ${{ inputs.publish || startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/develop' }}
   117            file: ./docker/${{ matrix.app }}.dockerfile
   118            platforms: ${{ inputs.archs || 'linux/amd64, linux/arm64' }}
   119            tags: |
   120              ghcr.io/vegaprotocol/vega/${{ matrix.app }}:latest
   121              ghcr.io/vegaprotocol/vega/${{ matrix.app }}:${{ steps.tags.outputs.version }}
   122  
   123        - name: GitHub docker image digest
   124          run: echo ${{ steps.docker_build_github.outputs.digest }}
   125  
   126        - name: Build and push to DockerHub
   127          id: docker_build
   128          uses: docker/build-push-action@v3
   129          with:
   130            context: .
   131            push: ${{ inputs.publish || startsWith(github.ref, 'refs/tags/') }}
   132            file: ./docker/${{ matrix.app }}.dockerfile
   133            platforms: ${{ inputs.archs || 'linux/amd64, linux/arm64' }}
   134            tags: |
   135              vegaprotocol/${{ matrix.app }}:latest
   136              vegaprotocol/${{ matrix.app }}:${{ steps.tags.outputs.version }}
   137  
   138        - name: DockerHub docker image digest
   139          run: echo ${{ steps.docker_build.outputs.digest }}