diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cab1638..955344d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: build +name: Docker Build on: push: @@ -6,41 +6,8 @@ on: - cron: '30 2 * * 0' workflow_dispatch: -env: - DOCKER_REGISTRY: ghcr.io - DOCKER_REPO: ${{ github.repository_owner }} - DOCKER_IMAGE: minidlna - DOCKER_PLATFORM: linux/amd64,linux/arm64 - jobs: - build-docker: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - platforms: arm64 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - version: v0.9.1 - - name: Login to Docker registry - uses: docker/login-action@v2 - with: - registry: ${{ env.DOCKER_REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and publish image - run: | - DOCKER_TAG="${{ github.ref_name }}" - docker buildx build --platform ${DOCKER_PLATFORM} --tag "${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:${DOCKER_TAG}" --label org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} --push . - echo "Docker images:" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "- \`${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:${DOCKER_TAG}\`" >> $GITHUB_STEP_SUMMARY - if [ "${{ github.ref_type }}" != "tag" ]; then - DOCKER_TAG="${{ github.ref_name }}-$(date +'%Y%m%d-%H%M')-$(echo ${{ github.sha }} | head -c 7)" - docker buildx build --platform ${DOCKER_PLATFORM} --tag "${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:${DOCKER_TAG}" --label org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} --push . - echo "- \`${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:${DOCKER_TAG}\`" >> $GITHUB_STEP_SUMMARY - fi + build: + uses: fab-infra/actions/.github/workflows/docker-build.yml@master + with: + docker-image: minidlna