name: Build docker images env: DOCKER_BASE_NAME: 'ghcr.io/${{ github.repository_owner }}/cert-manager-webhook-dnsimple' on: workflow_call: inputs: tags: description: 'Tags to build the image for (separated by a whitespace)' required: true type: string jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GHCR uses: docker/login-action@v3 with: registry: ghcr.io password: ${{ secrets.GITHUB_TOKEN }} username: ${{ github.repository_owner }} - name: Format tags id: format-tags # prepends DOCKER_BASE_NAME to every entry in the string ${{ inputs.tags }} run: | echo "TAGS=$(printf '${{ env.DOCKER_BASE_NAME }}:%s,' ${{ inputs.tags }})" >> $GITHUB_OUTPUT - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.format-tags.outputs.TAGS }}