name: Build Docker images on: create: tags: ['v*'] push: branches: [main] pull_request: branches: [main] jobs: build: strategy: matrix: app: ['builder', 'viewer'] runs-on: ubuntu-latest steps: - name: Check out the repo uses: actions/checkout@v3 - name: Extract existing image metadata id: image-meta uses: docker/metadata-action@v4 with: images: baptistearno/typebot-${{ matrix.app }} tags: | type=ref,event=branch type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - if: github.event_name != 'pull_request' name: Log in to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build image uses: docker/build-push-action@v3 with: context: . push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.image-meta.outputs.tags }} labels: ${{ steps.image-meta.outputs.labels }} build-args: | SCOPE=${{ matrix.app }}