Skip to content

Commit

Permalink
Use GitHub Actions reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fcrespel committed Jan 23, 2023
1 parent 9b3bdfd commit 09c7bbd
Showing 1 changed file with 5 additions and 38 deletions.
43 changes: 5 additions & 38 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,13 @@
name: build
name: Docker Build

on:
push:
schedule:
- 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

0 comments on commit 09c7bbd

Please sign in to comment.