-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (58 loc) · 1.65 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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 }}