name: Build & Publish to Docker Hub on: workflow_call: inputs: base_version: description: 'Base version (latest or develop)' required: true type: string info_version: description: 'Informational version number (e.g. 0.3.7-alpha)' required: true type: string tag_version: description: 'Docker tag version (e.g. v0.3.7)' required: true type: string secrets: docker_hub_username: required: true docker_hub_access_token: required: true jobs: build_and_push: name: Build & Publish runs-on: ${{ matrix.os }} if: contains(github.event.head_commit.message, '[no build]') == false strategy: matrix: include: - name: amd64 os: ubuntu-latest path: '' suffix: '-amd64' qemu: false platform: 'linux/amd64' - name: arm32v7 os: ubuntu-latest path: 'arm32v7/' suffix: '-arm' qemu: true platform: 'linux/arm/v7' - name: arm64 os: ubuntu-24.04-arm path: 'arm64/' suffix: '-arm64' qemu: true platform: 'linux/arm64' steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up QEMU uses: docker/setup-qemu-action@v3 if: ${{ matrix.qemu == true }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 id: docker-buildx - name: Login to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.docker_hub_username }} password: ${{ secrets.docker_hub_access_token }} - name: Log in to the Container registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v5 with: builder: ${{ steps.docker-buildx.outputs.name }} context: . file: ./docker/${{ matrix.path }}Dockerfile push: true provenance: false platforms: ${{ matrix.platform }} build-args: | INFO_VERSION=${{ inputs.info_version }}-docker${{ matrix.suffix }} tags: | jasongdove/ersatztv:${{ inputs.base_version }}${{ matrix.suffix }} jasongdove/ersatztv:${{ inputs.tag_version }}${{ matrix.suffix }} ghcr.io/ersatztv/ersatztv:${{ inputs.base_version }}${{ matrix.suffix }} ghcr.io/ersatztv/ersatztv:${{ inputs.tag_version }}${{ matrix.suffix }} merge_manifests: name: Merge Manifests runs-on: ubuntu-latest needs: build_and_push steps: - name: Login to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.docker_hub_username }} password: ${{ secrets.docker_hub_access_token }} - name: Log in to the Container registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Create and push manifests run: | docker manifest create jasongdove/ersatztv:${{ inputs.base_version }} \ jasongdove/ersatztv:${{ inputs.base_version }}-amd64 \ jasongdove/ersatztv:${{ inputs.base_version }}-arm64 \ jasongdove/ersatztv:${{ inputs.base_version }}-arm docker manifest push jasongdove/ersatztv:${{ inputs.base_version }} docker manifest create jasongdove/ersatztv:${{ inputs.tag_version }} \ jasongdove/ersatztv:${{ inputs.tag_version }}-amd64 \ jasongdove/ersatztv:${{ inputs.tag_version }}-arm64 \ jasongdove/ersatztv:${{ inputs.tag_version }}-arm docker manifest push jasongdove/ersatztv:${{ inputs.tag_version }} docker manifest create ghcr.io/ersatztv/ersatztv:${{ inputs.base_version }} \ ghcr.io/ersatztv/ersatztv:${{ inputs.base_version }}-amd64 \ ghcr.io/ersatztv/ersatztv:${{ inputs.base_version }}-arm64 \ ghcr.io/ersatztv/ersatztv:${{ inputs.base_version }}-arm docker manifest push ghcr.io/ersatztv/ersatztv:${{ inputs.base_version }} docker manifest create ghcr.io/ersatztv/ersatztv:${{ inputs.tag_version }} \ ghcr.io/ersatztv/ersatztv:${{ inputs.tag_version }}-amd64 \ ghcr.io/ersatztv/ersatztv:${{ inputs.tag_version }}-arm64 \ ghcr.io/ersatztv/ersatztv:${{ inputs.tag_version }}-arm docker manifest push ghcr.io/ersatztv/ersatztv:${{ inputs.tag_version }}