name: docker on: workflow_dispatch: push: branches: - 'master' tags: - 'v*' jobs: build-and-push: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Docker meta id: meta uses: docker/metadata-action@v4 with: images: ${{ github.repository }} tags: | type=ref,event=branch type=semver,pattern={{version}},enable=false type=match,pattern=v(.*),group=1 - name: Docker meta Hardware id: meta-hw uses: docker/metadata-action@v4 with: images: ${{ github.repository }} flavor: | suffix=-hardware latest=false tags: | type=ref,event=branch type=semver,pattern={{version}},enable=false type=match,pattern=v(.*),group=1 - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to DockerHub if: github.event_name != 'pull_request' uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v3 with: context: . platforms: | linux/amd64 linux/386 linux/arm/v7 linux/arm64/v8 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - name: Build and push Hardware uses: docker/build-push-action@v3 with: context: . file: hardware.Dockerfile platforms: linux/amd64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta-hw.outputs.tags }} labels: ${{ steps.meta-hw.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max