Skip to content

Build

Build #60

Workflow file for this run

name: "Build"
on:
workflow_dispatch:
push:
branches:
- master
schedule:
# Random time each week.
- cron: '52 7 * * 4'
jobs:
build:
permissions:
packages: write
runs-on: ubuntu-latest
strategy:
matrix:
type:
- jellyfin
- jellyfin-web
env:
IMAGE: ghcr.io/${{ github.repository }}/${{ matrix.type }}
CONTEXT: ./src/${{ matrix.type }}
steps:
- uses: docker/setup-buildx-action@v2
with:
install: true
version: latest
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v4
id: meta
with:
images: ${{ env.IMAGE }}
tags: |
type=schedule,pattern=weekly
type=schedule,pattern=weekly-{{date 'YYYYMMDD'}}
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,prefix=sha-,format=short
type=raw,value=latest,enable={{is_default_branch}}
- uses: actions/checkout@v3
with:
submodules: true
- uses: docker/build-push-action@v4
id: build
with:
file: ${{ env.CONTEXT }}/Dockerfile
context: ${{ env.CONTEXT }}
push: true
pull: true
cache-from: ${{ format('type=registry,ref={0}:cache', env.IMAGE) || ''}}
cache-to: ${{ format('type=registry,ref={0}:cache,mode=max', env.IMAGE) || ''}}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}