name: Build the container image

on:
  pull_request:
    branches:
      - master
  push:
    branches:
      - master
  release:
    types:
      - published

jobs:

  build:
    name: Build the container image
    runs-on: ubuntu-latest
    steps:

      - name: Check out the repository
        uses: actions/checkout@v2.3.5

      - name: Build the container image
        uses: docker/build-push-action@v1.1.0
        with:
          repository: python-rainwave-client-helper

      - name: Tag and push the image
        if: github.event_name == 'push'
        uses: docker/build-push-action@v1.1.0
        with:
          repository: ${{ github.repository_owner }}/python-rainwave-client-helper
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ github.token }}
          tag_with_ref: true
          add_git_labels: true

name: Build the container image

on:
  pull_request:
    branches:
      - master
  push:
    branches:
      - master
  workflow_dispatch:

env:
  image_name: ghcr.io/williamjacksn/python-rainwave-client-helper

jobs:
  build:
    name: Build the container image
    runs-on: ubuntu-latest
    steps:

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1.6.0

      - name: Build the container image
        uses: docker/build-push-action@v2.5.0
        with:
          build-args: |
            BUILDKIT_INLINE_CACHE=1
          cache-from: |
            ${{ env.image_name }}
          load: true
          tags: ${{ env.image_name }}

      - name: Log in to GitHub container registry
        if: github.event_name == 'push'
        uses: docker/login-action@v1.10.0
        with:
          registry: ghcr.io
          password: ${{ github.token }}
          username: ${{ github.actor }}

      - name: Push latest image to registry
        if: github.event_name == 'push'
        run: docker image push ${{ env.image_name }}

Use latest Docker workflow actions
Use latest Docker workflow actions