name: Docker on: push: branches: - master - next tags: - v* pull_request: jobs: build: runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - context: ./back label: back image: zoriya/kyoo_back - context: ./front label: front image: zoriya/kyoo_front - context: ./scanner label: scanner image: zoriya/kyoo_scanner - context: ./autosync label: autosync image: zoriya/kyoo_autosync - context: ./transcoder label: transcoder image: zoriya/kyoo_transcoder name: Build ${{matrix.label}} steps: - uses: actions/checkout@v4 - uses: dorny/paths-filter@v3 id: filter with: filters: | should_run: - '${{matrix.context}}/**' - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ${{matrix.image}} tags: | type=edge type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - name: Check if a package should be pushed run: | echo "SHOULD_PUSH=$([ "${GITHUB_REF##*/}" == "master" ] || [ "${GITHUB_REF##*/}" == "next" ] && echo "true" || echo "false")" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to DockerHub if: env.SHOULD_PUSH == 'true' uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push id: docker_build uses: docker/build-push-action@v5 if: steps.filter.outputs.should_run == 'true' with: context: ${{matrix.context}} platforms: linux/amd64,linux/arm64 build-args: | VERSION=0.0.0 push: ${{env.SHOULD_PUSH}} tags: ${{steps.meta.outputs.tags}} cache-from: type=gha cache-to: type=gha,mode=max - name: Sync README.MD if: env.SHOULD_PUSH == 'true' uses: ms-jpq/sync-dockerhub-readme@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} repository: ${{ matrix.image }} readme: "./README.md"